📄 pdfencryptor.html
字号:
</DD></DL><HR><A NAME="encrypt(com.lowagie.text.pdf.PdfReader, java.io.OutputStream, int, java.lang.String, java.lang.String, int)"><!-- --></A><H3>encrypt</H3><PRE>public static void <B>encrypt</B>(<A HREF="../../../../com/lowagie/text/pdf/PdfReader.html" title="class in com.lowagie.text.pdf">PdfReader</A> reader, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A> os, int type, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> userPassword, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> ownerPassword, int permissions) throws <A HREF="../../../../com/lowagie/text/DocumentException.html" title="class in com.lowagie.text">DocumentException</A>, <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE><DL><DD>Entry point to encrypt a PDF document. The encryption parameters are the same as in <code>PdfWriter</code>. The userPassword and the ownerPassword can be null or have zero length. In this case the ownerPassword is replaced by a random string. The open permissions for the document can be AllowPrinting, AllowModifyContents, AllowCopy, AllowModifyAnnotations, AllowFillIn, AllowScreenReaders, AllowAssembly and AllowDegradedPrinting. The permissions can be combined by ORing them.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>reader</CODE> - the read PDF<DD><CODE>os</CODE> - the output destination<DD><CODE>type</CODE> - the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128. Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext<DD><CODE>userPassword</CODE> - the user password. Can be null or empty<DD><CODE>ownerPassword</CODE> - the owner password. Can be null or empty<DD><CODE>permissions</CODE> - the user permissions values delete the key in the original info dictionary<DT><B>Throws:</B><DD><CODE><A HREF="../../../../com/lowagie/text/DocumentException.html" title="class in com.lowagie.text">DocumentException</A></CODE> - on error<DD><CODE><A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE> - on error</DL></DD></DL><HR><A NAME="getPermissionsVerbose(int)"><!-- --></A><H3>getPermissionsVerbose</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>getPermissionsVerbose</B>(int permissions)</PRE><DL><DD>Give you a verbose analysis of the permissions.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the permissions value of a PDF file<DT><B>Returns:</B><DD>a String that explains the meaning of the permissions value</DL></DD></DL><HR><A NAME="isPrintingAllowed(int)"><!-- --></A><H3>isPrintingAllowed</H3><PRE>public static boolean <B>isPrintingAllowed</B>(int permissions)</PRE><DL><DD>Tells you if printing is allowed.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the permissions value of a PDF file<DT><B>Returns:</B><DD>true if printing is allowed<DT><B>Since:</B></DT> <DD>2.0.7</DD></DL></DD></DL><HR><A NAME="isModifyContentsAllowed(int)"><!-- --></A><H3>isModifyContentsAllowed</H3><PRE>public static boolean <B>isModifyContentsAllowed</B>(int permissions)</PRE><DL><DD>Tells you if modifying content is allowed.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the permissions value of a PDF file<DT><B>Returns:</B><DD>true if modifying content is allowed<DT><B>Since:</B></DT> <DD>2.0.7</DD></DL></DD></DL><HR><A NAME="isCopyAllowed(int)"><!-- --></A><H3>isCopyAllowed</H3><PRE>public static boolean <B>isCopyAllowed</B>(int permissions)</PRE><DL><DD>Tells you if copying is allowed.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the permissions value of a PDF file<DT><B>Returns:</B><DD>true if copying is allowed<DT><B>Since:</B></DT> <DD>2.0.7</DD></DL></DD></DL><HR><A NAME="isModifyAnnotationsAllowed(int)"><!-- --></A><H3>isModifyAnnotationsAllowed</H3><PRE>public static boolean <B>isModifyAnnotationsAllowed</B>(int permissions)</PRE><DL><DD>Tells you if modifying annotations is allowed.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the permissions value of a PDF file<DT><B>Returns:</B><DD>true if modifying annotations is allowed<DT><B>Since:</B></DT> <DD>2.0.7</DD></DL></DD></DL><HR><A NAME="isFillInAllowed(int)"><!-- --></A><H3>isFillInAllowed</H3><PRE>public static boolean <B>isFillInAllowed</B>(int permissions)</PRE><DL><DD>Tells you if filling in fields is allowed.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the permissions value of a PDF file<DT><B>Returns:</B><DD>true if filling in fields is allowed<DT><B>Since:</B></DT> <DD>2.0.7</DD></DL></DD></DL><HR><A NAME="isScreenReadersAllowed(int)"><!-- --></A><H3>isScreenReadersAllowed</H3><PRE>public static boolean <B>isScreenReadersAllowed</B>(int permissions)</PRE><DL><DD>Tells you if repurposing for screenreaders is allowed.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the permissions value of a PDF file<DT><B>Returns:</B><DD>true if repurposing for screenreaders is allowed<DT><B>Since:</B></DT> <DD>2.0.7</DD></DL></DD></DL><HR><A NAME="isAssemblyAllowed(int)"><!-- --></A><H3>isAssemblyAllowed</H3><PRE>public static boolean <B>isAssemblyAllowed</B>(int permissions)</PRE><DL><DD>Tells you if document assembly is allowed.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the permissions value of a PDF file<DT><B>Returns:</B><DD>true if document assembly is allowed<DT><B>Since:</B></DT> <DD>2.0.7</DD></DL></DD></DL><HR><A NAME="isDegradedPrintingAllowed(int)"><!-- --></A><H3>isDegradedPrintingAllowed</H3><PRE>public static boolean <B>isDegradedPrintingAllowed</B>(int permissions)</PRE><DL><DD>Tells you if degraded printing is allowed.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>permissions</CODE> - the permissions value of a PDF file<DT><B>Returns:</B><DD>true if degraded printing is allowed<DT><B>Since:</B></DT> <DD>2.0.7</DD></DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ======= START OF BOTTOM NAVBAR ====== --><A NAME="navbar_bottom"><!-- --></A><A HREF="#skip-navbar_bottom" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>Hosted by <a href="http://www.hostbasket.com/">Hostbasket</a></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../com/lowagie/text/pdf/PdfEncryption.html" title="class in com.lowagie.text.pdf"><B>PREV CLASS</B></A> <A HREF="../../../../com/lowagie/text/pdf/PdfException.html" title="class in com.lowagie.text.pdf"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/lowagie/text/pdf/PdfEncryptor.html" target="_top"><B>FRAMES</B></A> <A HREF="PdfEncryptor.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_bottom"></A><!-- ======== END OF BOTTOM NAVBAR ======= --><HR></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -