Package com.itextpdf.text.pdf
Class PdfCopyForms
- java.lang.Object
-
- com.itextpdf.text.pdf.PdfCopyForms
-
- All Implemented Interfaces:
PdfEncryptionSettings
,PdfViewerPreferences
public class PdfCopyForms extends java.lang.Object implements PdfViewerPreferences, PdfEncryptionSettings
Deprecated.since 5.5.2Allows you to add one (or more) existing PDF document(s) to create a new PDF and add the form of another PDF document to this new PDF.- Since:
- 2.1.5
-
-
Field Summary
Fields Modifier and Type Field Description private PdfCopyFormsImp
fc
Deprecated.The class with the actual implementations.
-
Constructor Summary
Constructors Constructor Description PdfCopyForms(java.io.OutputStream os)
Deprecated.Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addDocument(PdfReader reader)
Deprecated.Concatenates a PDF document.void
addDocument(PdfReader reader, java.lang.String ranges)
Deprecated.Concatenates a PDF document selecting the pages to keep.void
addDocument(PdfReader reader, java.util.List<java.lang.Integer> pagesToKeep)
Deprecated.Concatenates a PDF document selecting the pages to keep.void
addJavaScript(java.lang.String js)
Deprecated.Adds JavaScript to the global documentvoid
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 addedPdfWriter
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, java.lang.String userPassword, java.lang.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(java.security.cert.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(java.util.List<java.util.HashMap<java.lang.String,java.lang.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.
-
-
-
Field Detail
-
fc
private PdfCopyFormsImp fc
Deprecated.The class with the actual implementations.
-
-
Constructor Detail
-
PdfCopyForms
public PdfCopyForms(java.io.OutputStream os) throws DocumentException
Deprecated.Creates a new instance.- Parameters:
os
- the output stream- Throws:
DocumentException
- on error
-
-
Method Detail
-
addDocument
public void addDocument(PdfReader reader) throws DocumentException, java.io.IOException
Deprecated.Concatenates a PDF document.- Parameters:
reader
- the PDF document- Throws:
DocumentException
- on errorjava.io.IOException
-
addDocument
public void addDocument(PdfReader reader, java.util.List<java.lang.Integer> pagesToKeep) throws DocumentException, java.io.IOException
Deprecated.Concatenates a PDF document selecting the pages to keep. The pages are described as aList
ofInteger
. The page ordering can be changed but no page repetitions are allowed.- Parameters:
reader
- the PDF documentpagesToKeep
- the pages to keep- Throws:
DocumentException
- on errorjava.io.IOException
-
addDocument
public void addDocument(PdfReader reader, java.lang.String ranges) throws DocumentException, java.io.IOException
Deprecated.Concatenates a PDF document selecting the pages to keep. The pages are described as ranges. The page ordering can be changed but no page repetitions are allowed.- Parameters:
reader
- the PDF documentranges
- the comma separated ranges as described inSequenceList
- Throws:
DocumentException
- on errorjava.io.IOException
-
copyDocumentFields
public void copyDocumentFields(PdfReader reader) throws DocumentException
Deprecated.Copies the form fields of this PDFDocument onto the PDF-Document which was added- Parameters:
reader
- the PDF document- Throws:
DocumentException
- on error
-
setEncryption
public void setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, boolean strength128Bits) throws DocumentException
Deprecated.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.- Parameters:
userPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissionsstrength128Bits
-true
for 128 bit key length,false
for 40 bit key length- Throws:
DocumentException
- if the document is already open
-
setEncryption
public void setEncryption(boolean strength, java.lang.String userPassword, java.lang.String ownerPassword, int permissions) throws DocumentException
Deprecated.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.- Parameters:
strength
- true for 128 bit key length. false for 40 bit key lengthuserPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissions- Throws:
DocumentException
- if the document is already open
-
close
public void close()
Deprecated.Closes the output document.
-
open
public void open()
Deprecated.Opens the document. This is usually not needed as addDocument() will do it automatically.
-
addJavaScript
public void addJavaScript(java.lang.String js)
Deprecated.Adds JavaScript to the global document- Parameters:
js
- the JavaScript
-
setOutlines
public void setOutlines(java.util.List<java.util.HashMap<java.lang.String,java.lang.Object>> outlines)
Deprecated.Sets the bookmarks. The list structure is defined inSimpleBookmark#
.- Parameters:
outlines
- the bookmarks ornull
to remove any
-
getWriter
public PdfWriter getWriter()
Deprecated.Gets the underlying PdfWriter.- Returns:
- the underlying PdfWriter
-
isFullCompression
public boolean isFullCompression()
Deprecated.Gets the 1.5 compression status.- Returns:
true
if the 1.5 compression is on
-
setFullCompression
public void setFullCompression() throws DocumentException
Deprecated.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.
- Throws:
DocumentException
-
setEncryption
public void setEncryption(byte[] userPassword, byte[] ownerPassword, int permissions, int encryptionType) throws DocumentException
Deprecated.Description copied from interface:PdfEncryptionSettings
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.- Specified by:
setEncryption
in interfacePdfEncryptionSettings
- Parameters:
userPassword
- the user password. Can be null or emptyownerPassword
- the owner password. Can be null or emptypermissions
- the user permissionsencryptionType
- 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- Throws:
DocumentException
- if the document is already open- See Also:
PdfEncryptionSettings.setEncryption(byte[], byte[], int, int)
-
addViewerPreference
public void addViewerPreference(PdfName key, PdfObject value)
Deprecated.Description copied from interface:PdfViewerPreferences
Adds a viewer preference.- In case the key is one of these values:
- PdfName.HIDETOOLBAR
- PdfName.HIDEMENUBAR
- PdfName.HIDEWINDOWUI
- PdfName.FITWINDOW
- PdfName.CENTERWINDOW
- PdfName.DISPLAYDOCTITLE
- In case the key is PdfName.NONFULLSCREENPAGEMODE,
the value must be one of these names:
- PdfName.USENONE
- PdfName.USEOUTLINES
- PdfName.USETHUMBS
- PdfName.USEOC
- In case the key is PdfName.DIRECTION,
the value must be one of these names:
- PdfName.L2R
- PdfName.R2L
- In case the key is one of these values:
- PdfName.VIEWAREA
- PdfName.VIEWCLIP
- PdfName.PRINTAREA
- PdfName.PRINTCLIP
- PdfName.MEDIABOX
- PdfName.CROPBOX
- PdfName.BLEEDBOX
- PdfName.TRIMBOX
- PdfName.ARTBOX
- In case the key is PdfName.PRINTSCALING, the value can be
- PdfName.APPDEFAULT
- PdfName.NONE
- In case the key is PdfName.DUPLEX, the value can be:
- PdfName.SIMPLEX
- PdfName.DUPLEXFLIPSHORTEDGE
- PdfName.DUPLEXFLIPLONGEDGE
- In case the key is PdfName.PICKTRAYBYPDFSIZE, the value must be of type PdfBoolean.
- In case the key is PdfName.PRINTPAGERANGE, the value must be of type PdfArray.
- In case the key is PdfName.NUMCOPIES, the value must be of type PdfNumber.
- Specified by:
addViewerPreference
in interfacePdfViewerPreferences
- Parameters:
key
- the name of the viewer preferencevalue
- the value of the viewer preference- See Also:
PdfViewerPreferences.addViewerPreference(com.itextpdf.text.pdf.PdfName, com.itextpdf.text.pdf.PdfObject)
- In case the key is one of these values:
-
setViewerPreferences
public void setViewerPreferences(int preferences)
Deprecated.Description copied from interface:PdfViewerPreferences
Sets the page layout and page mode preferences by ORing one or two of these constants.- The page layout to be used when the document is opened (choose one).
- PageLayoutSinglePage - Display one page at a time. (default)
- PageLayoutOneColumn - Display the pages in one column.
- PageLayoutTwoColumnLeft - Display the pages in two columns, with odd-numbered pages on the left.
- PageLayoutTwoColumnRight - Display the pages in two columns, with odd-numbered pages on the right.
- PageLayoutTwoPageLeft - Display the pages two at a time, with odd-numbered pages on the left.
- PageLayoutTwoPageRight - Display the pages two at a time, with odd-numbered pages on the right.
- The page mode how the document should be displayed
when opened (choose one).
- PageModeUseNone - Neither document outline nor thumbnail images visible. (default)
- PageModeUseOutlines - Document outline visible.
- PageModeUseThumbs - Thumbnail images visible.
- PageModeFullScreen - Full-screen mode, with no menu bar, window controls, or any other window visible.
- PageModeUseOC - Optional content group panel visible
- PageModeUseAttachments - Attachments panel visible
addViewerPreference(key, value)
if you want to change the following preferences:- HideToolbar - A flag specifying whether to hide the viewer application's tool bars when the document is active.
- HideMenubar - A flag specifying whether to hide the viewer application's menu bar when the document is active.
- HideWindowUI - A flag specifying whether to hide user interface elements in the document's window (such as scroll bars and navigation controls), leaving only the document's contents displayed.
- FitWindow - A flag specifying whether to resize the document's window to fit the size of the first displayed page.
- CenterWindow - A flag specifying whether to position the document's window in the center of the screen.
- DisplayDocTitle - A flag specifying whether to display the document's title in the top bar.
- The predominant reading order for text. This entry has no direct effect on the
document's contents or page numbering, but can be used to determine the relative
positioning of pages when displayed side by side or printed n-up (choose one).
- DirectionL2R - Left to right
- DirectionR2L - Right to left (including vertical writing systems such as Chinese, Japanese, and Korean)
- The document's page mode, specifying how to display the
document on exiting full-screen mode. It is meaningful only
if the page mode is PageModeFullScreen (choose one).
- NonFullScreenPageModeUseNone - Neither document outline nor thumbnail images visible
- NonFullScreenPageModeUseOutlines - Document outline visible
- NNonFullScreenPageModeUseThumbs - Thumbnail images visible
- NonFullScreenPageModeUseOC - Optional content group panel visible
- PrintScalingNone - Indicates that the print dialog should reflect no page scaling.
- Specified by:
setViewerPreferences
in interfacePdfViewerPreferences
- Parameters:
preferences
- the viewer preferences- See Also:
PdfViewerPreferences.setViewerPreferences(int)
- The page layout to be used when the document is opened (choose one).
-
setEncryption
public void setEncryption(java.security.cert.Certificate[] certs, int[] permissions, int encryptionType) throws DocumentException
Deprecated.Description copied from interface:PdfEncryptionSettings
Sets the certificate encryption options for this document. An array of one or more public certificates must be provided together with an array of the same size for the permissions for each certificate. 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. Optionally DO_NOT_ENCRYPT_METADATA can be ored to output the metadata in cleartext- Specified by:
setEncryption
in interfacePdfEncryptionSettings
- Parameters:
certs
- the public certificates to be used for the encryptionpermissions
- the user permissions for each of the certificatesencryptionType
- the type of encryption. It can be one of STANDARD_ENCRYPTION_40, STANDARD_ENCRYPTION_128 or ENCRYPTION_AES128.- Throws:
DocumentException
- if the document is already open- See Also:
PdfEncryptionSettings.setEncryption(java.security.cert.Certificate[], int[], int)
-
-