public class PdfCopyForms extends Object implements PdfViewerPreferences, PdfEncryptionSettings
Constructor and Description |
---|
PdfCopyForms(OutputStream os)
Deprecated.
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addDocument(PdfReader reader)
Deprecated.
Concatenates a PDF document.
|
void |
addDocument(PdfReader reader, List<Integer> pagesToKeep)
Deprecated.
Concatenates a PDF document selecting the pages to keep.
|
void |
addDocument(PdfReader reader, String ranges)
Deprecated.
Concatenates a PDF document selecting the pages to keep.
|
void |
addJavaScript(String js)
Deprecated.
Adds JavaScript to the global document
|
void |
addViewerPreference(PdfName key, PdfObject value)
Deprecated.
Adds a viewer preference.
|
void |
close()
Deprecated.
Closes the output document.
|
void |
copyDocumentFields(PdfReader reader)
Deprecated.
Copies the form fields of this PDFDocument onto the PDF-Document which was added
|
PdfWriter |
getWriter()
Deprecated.
Gets the underlying PdfWriter.
|
boolean |
isFullCompression()
Deprecated.
Gets the 1.5 compression status.
|
void |
open()
Deprecated.
Opens the document.
|
void |
setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions)
Deprecated.
Sets the encryption options for this document.
|
void |
setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, boolean strength128Bits)
Deprecated.
Sets the encryption options for this document.
|
void |
setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionType)
Deprecated.
Sets the encryption options for this document.
|
void |
setEncryption(Certificate[] certs, int[] permissions, int encryptionType)
Deprecated.
Sets the certificate encryption options for this document.
|
void |
setFullCompression()
Deprecated.
Sets the document's compression to the new 1.5 mode with object streams and xref streams.
|
void |
setOutlines(List<HashMap<String,Object>> outlines)
Deprecated.
Sets the bookmarks.
|
void |
setViewerPreferences(int preferences)
Deprecated.
Sets the page layout and page mode preferences by ORing one or two of these constants.
|
public PdfCopyForms(OutputStream os) throws DocumentException
os
- the output stream
DocumentException
- on error
public void addDocument(PdfReader reader) throws DocumentException, IOException
reader
- the PDF document
DocumentException
- on error
IOException
public void addDocument(PdfReader reader, List<Integer> pagesToKeep) throws DocumentException, IOException
List
of Integer
. The page ordering can be changed but no page repetitions are allowed.
reader
- the PDF document
pagesToKeep
- the pages to keep
DocumentException
- on error
IOException
public void addDocument(PdfReader reader, String ranges) throws DocumentException, IOException
reader
- the PDF document
ranges
- the comma separated ranges as described in SequenceList
DocumentException
- on error
IOException
public void copyDocumentFields(PdfReader reader) throws DocumentException
reader
- the PDF document
DocumentException
- on error
public void setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, boolean strength128Bits) throws DocumentException
userPassword
- the user password. Can be null or empty
ownerPassword
- the owner password. Can be null or empty
permissions
- the user permissions
strength128Bits
- true
for 128 bit key length, false
for 40 bit key length
DocumentException
- if the document is already open
public void setEncryption(boolean strength, String userPassword, String ownerPassword, int permissions) throws DocumentException
strength
- true for 128 bit key length. false for 40 bit key length
userPassword
- the user password. Can be null or empty
ownerPassword
- the owner password. Can be null or empty
permissions
- the user permissions
DocumentException
- if the document is already open
public void close()
public void open()
public void addJavaScript(String js)
js
- the JavaScript
public void setOutlines(List<HashMap<String,Object>> outlines)
SimpleBookmark#
.
outlines
- the bookmarks or null
to remove any
public PdfWriter getWriter()
public boolean isFullCompression()
true
if the 1.5 compression is on
public void setFullCompression() throws DocumentException
If set before opening the document it will also set the pdf version to 1.5.
DocumentException
public void setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionType) throws DocumentException
PdfEncryptionSettings
setEncryption
in interface PdfEncryptionSettings
userPassword
- the user password. Can be null or empty
ownerPassword
- the owner password. Can be null or empty
permissions
- the user permissions
encryptionType
- 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
DocumentException
- if the document is already open
PdfEncryptionSettings.setEncryption(byte[], byte[], int, int)
public void addViewerPreference(PdfName key, PdfObject value)
PdfViewerPreferences
addViewerPreference
in interface PdfViewerPreferences
key
- the name of the viewer preference
value
- the value of the viewer preference
PdfViewerPreferences.addViewerPreference(com.itextpdf.text.pdf.PdfName, com.itextpdf.text.pdf.PdfObject)
public void setViewerPreferences(int preferences)
PdfViewerPreferences
addViewerPreference(key, value)
if you want to change the following preferences:
setViewerPreferences
in interface PdfViewerPreferences
preferences
- the viewer preferences
PdfViewerPreferences.setViewerPreferences(int)
public void setEncryption(Certificate[] certs, int[] permissions, int encryptionType) throws DocumentException
PdfEncryptionSettings
setEncryption
in interface PdfEncryptionSettings
certs
- the public certificates to be used for the encryption
permissions
- the user permissions for each of the certificates
encryptionType
- the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.
DocumentException
- if the document is already open
PdfEncryptionSettings.setEncryption(java.security.cert.Certificate[], int[], int)
Copyright © 2016. All rights reserved.