List
of Integer
. The page ordering can be changed but
* no page repetitions are allowed.
* @param reader the PDF document
* @param pagesToKeep the pages to keep
* @throws DocumentException on error
*/
public void addDocument(PdfReader reader, Listtrue
for 128 bit key length, false
for 40 bit key length
* @throws DocumentException if the document is already open
*/
public void setEncryption(byte userPassword[], byte ownerPassword[], int permissions, boolean strength128Bits) throws DocumentException {
fc.setEncryption(userPassword, ownerPassword, permissions, strength128Bits ? PdfWriter.STANDARD_ENCRYPTION_128 : PdfWriter.STANDARD_ENCRYPTION_40);
}
/**
* Sets the encryption options for this document. 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.
* @param strength true for 128 bit key length. false for 40 bit key length
* @param userPassword the user password. Can be null or empty
* @param ownerPassword the owner password. Can be null or empty
* @param permissions the user permissions
* @throws DocumentException if the document is already open
*/
public void setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions) throws DocumentException {
setEncryption(DocWriter.getISOBytes(userPassword), DocWriter.getISOBytes(ownerPassword), permissions, strength);
}
/**
* Closes the output document.
*/
public void close() {
fc.close();
}
/**
* Opens the document. This is usually not needed as addDocument() will do it
* automatically.
*/
public void open() {
fc.openDoc();
}
/**
* Adds JavaScript to the global document
* @param js the JavaScript
*/
public void addJavaScript(String js) {
fc.addJavaScript(js, !PdfEncodings.isPdfDocEncoding(js));
}
/**
* Sets the bookmarks. The list structure is defined in
* SimpleBookmark#
.
* @param outlines the bookmarks or null
to remove any
*/
public void setOutlines(Listtrue
if the 1.5 compression is on
*/
public boolean isFullCompression() {
return fc.isFullCompression();
}
/**
* Sets the document's compression to the new 1.5 mode with object streams and xref
* streams. It can be set at any time but once set it can't be unset.
* * If set before opening the document it will also set the pdf version to 1.5. */ public void setFullCompression() { fc.setFullCompression(); } /** * @see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(byte[], byte[], int, int) */ public void setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionType) throws DocumentException { fc.setEncryption(userPassword, ownerPassword, permissions, encryptionType); } /** * @see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#addViewerPreference(com.lowagie.text.pdf.PdfName, com.lowagie.text.pdf.PdfObject) */ public void addViewerPreference(PdfName key, PdfObject value) { fc.addViewerPreference(key, value); } /** * @see com.lowagie.text.pdf.interfaces.PdfViewerPreferences#setViewerPreferences(int) */ public void setViewerPreferences(int preferences) { fc.setViewerPreferences(preferences); } /** * @see com.lowagie.text.pdf.interfaces.PdfEncryptionSettings#setEncryption(java.security.cert.Certificate[], int[], int) */ public void setEncryption(Certificate[] certs, int[] permissions, int encryptionType) throws DocumentException { fc.setEncryption(certs, permissions, encryptionType); } }