public class Document
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ALL_PAGES
All pages.
|
static int |
BEFORE_FIRST_PAGE
Before first page.
|
static int |
LAST_PAGE
Last page.
|
| Constructor and Description |
|---|
Document()
Creates a new document.
|
Document(javax.imageio.stream.ImageInputStream stream)
Open a Document from a javax.imageio.stream.ImageInputStream.
|
Document(javax.imageio.stream.ImageInputStream stream,
java.lang.String password,
PermissionRequestOperation perms,
boolean doRepair)
Open a Document from a javax.imageio.stream.ImageInputStream.
|
Document(com.datalogics.PDFL.JavaStreamFile file) |
Document(com.datalogics.PDFL.JavaStreamFile file,
java.lang.String password,
PermissionRequestOperation perms,
boolean doRepair) |
Document(java.lang.String fileName)
Opens the specified document.
|
Document(java.lang.String fileName,
java.lang.String password,
PermissionRequestOperation perms,
boolean doRepair)
Opens the specified document.
|
Document(java.lang.String XPSFilename,
XPSConvertParams ConversionParams)
Create a Document from an XPS file.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
applyRedactions() |
boolean |
applyRedactions(Redaction redact) |
PDFAConvertResult |
cloneAsPDFADocument(PDFAConvertType type,
PDFAConvertParams parms)
Create a PDF/A compliant version of this Document.
|
PDFXConvertResult |
cloneAsPDFXDocument(PDFXConvertType type,
PDFXConvertParams parms)
Create a PDF/X compliant version of this Document.
|
void |
close()
Closes a document and releases its resources.
|
void |
collectNamesOfTree(PDFArray namesArray,
java.util.List<FileAttachment> attachments) |
boolean |
colorConvertPages(ColorConvertParams params)
Convert the colors (in place) in a Document as specified by by the params block by applying an ICC profile to the objects contained in the Document.
|
static boolean |
convertToExcel(java.lang.String inputPDFFileFilePath,
java.lang.String outputOfficeFilePath)
This function converts a PDF file to a Microsoft Excel Office file (.xlsx).
|
static boolean |
convertToPowerPoint(java.lang.String inputPDFFileFilePath,
java.lang.String outputOfficeFilePath)
This function converts a PDF file to a Microsoft PowerPoint Office file (.pptx).
|
static boolean |
convertToWord(java.lang.String inputPDFFileFilePath,
java.lang.String outputOfficeFilePath)
This function converts a PDF file to a Microsoft Word Office file (.docx).
|
long |
convertXFAFieldsToAcroFormFields()
Convert a XFA document into a document with only AcroForms.
|
int |
countXMPMetadataArrayItems(java.lang.String namespaceName,
java.lang.String path)
Returns the number of array items in a property array associated with a Document.
|
void |
createCollection()
CreateCollection allows to create new collection in the PDF document. It replaces any existing collection.
|
NameTree |
createNameTree(java.lang.String nameTreeName)
Retrieves the name tree inside the Names dictionary with the specified key name, or creates it if it does not exist.
|
Page |
createPage(int afterPageNum,
Rect mediaBox)
Creates and acquires a new Page.
|
void |
delete()
Closes that document and releases its resources.
|
void |
deletePages(int firstPage,
int lastPage)
Deletes the specified pages.
|
void |
deletePages(int firstPage,
int lastPage,
java.util.EnumSet<PageDeleteFlags> deleteFlags)
Deletes the specified pages with option to parse Structure Tree.
|
void |
embedFonts()
Embed unembedded fonts in a document.
|
void |
embedFonts(java.util.EnumSet<EmbedFlags> flags)
Embed unembedded fonts in a document.
|
void |
embedFonts(java.util.EnumSet<EmbedFlags> flags,
ProgressMonitor progressMonitor,
CancelProc cancelProc,
ReportProc reportProc)
Embed unembedded fonts in a document.
|
void |
embedFonts(java.util.List<Font> fonts)
Embed specified fonts in a document.
|
void |
embedFonts(java.util.List<Font> fonts,
java.util.EnumSet<EmbedFlags> flags)
Embed specified fonts in a document.
|
void |
embedFonts(java.util.List<Font> fonts,
java.util.EnumSet<EmbedFlags> flags,
ProgressMonitor progressMonitor,
CancelProc cancelProc,
ReportProc reportProc)
Embed specified fonts in a document.
|
void |
embedOCRFonts()
Embed fonts that were used in creating OCR text.
|
boolean |
enumIndirectPDFObjects(PDFObjectEnumProc enumProc)
Enumerates all the indirect objects of this document.
|
boolean |
exportAcroFormsData(java.lang.String fileName,
AcroFormExportType exportType)
Export the AcroForms data.
|
void |
exportAsPostScript(PrintUserParams userParams,
PrintCancelProc printCancelProc,
PrintProgressProc printProgressProc,
java.lang.String path)
Exports a PDF document or pages from a PDF document as PostScript allowing the caller to specify options such as page size, rotation, and shrink-to-fit.
|
void |
exportAsPostScript(PrintUserParams userParams,
PrintCancelProc printCancelProc,
java.lang.String path)
Exports a PDF document or pages from a PDF document as PostScript allowing the caller to specify options such as page size, rotation, and shrink-to-fit.
|
void |
exportAsPostScript(PrintUserParams userParams,
java.lang.String path)
Exports a PDF document or pages from a PDF document as PostScript allowing the caller to specify options such as page size, rotation, and shrink-to-fit.
|
boolean |
exportXFAFormsData(java.lang.String fileName,
XFAFormExportType exportType)
Export the XFA Forms data.
|
Bookmark |
findBookmark(java.lang.String title)
Find bookmark by its title, searching within the document's entire bookmark tree.
|
Bookmark |
findBookmark(java.lang.String title,
int maxDepth)
Find bookmark by its title, searching within the document's bookmark tree to a depth determined by maxDepth (e.g., 0 = root bookmark only and not any of its children, 1 = search one level below root bookmark level, etc.
|
java.lang.String |
findLabelForPageNum(int pageIndex)
Fetch the label string for a page index, using the current page labels.
|
int |
findPageNumForLabel(java.lang.String label)
Look up a page index based on a label string.
|
PDFObject |
findPDFObjectByID(int ID)
Retrieves an indirect PDFObject by its ID number.
|
void |
flattenAcroFormFields()
Flatten a AcroForms document.
|
void |
flattenNonFormAnnotations()
Flatten a Non-Form (no AcroForm, no XFA) document's Annotations.
|
boolean |
flattenOptionalContent()
Flattens optional content in the document.
|
boolean |
flattenOptionalContent(OptionalContentContext occ)
Flattens optional content in the document.
|
int |
flattenTransparency()
Flattens all transparencies in the document.
|
int |
flattenTransparency(FlattenTransparencyParams params)
Flattens all transparencies in the document.
|
int |
flattenTransparency(FlattenTransparencyParams params,
int firstPage,
int lastPage)
Flattens transparencies in the document that occur on pages within the specified range.
|
long |
flattenXFAFormFields()
Flatten a XFA Document (Static or Dynamic).
|
long |
flattenXFAFormFieldsAsIfPrinted()
Flatten a XFA Document (Static or Dynamic) as if it was Printed.
|
java.util.List<FileAttachment> |
getAttachments()
Allows to obtain all attached files from the PDF document.
|
java.lang.String |
getAuthor()
The author of the PDF document.
|
java.lang.String |
getBaseURI()
The Base URI of the PDF document.
|
Bookmark |
getBookmarkRoot()
Gets the root of the document's bookmark tree.
|
Collection |
getCollection()
GetCollection allows to retrieve collection from the PDF document.
|
int |
getCompressionLevel()
The compression level of the document.
|
java.lang.String |
getCreator()
The creator of the PDF file.
|
OptionalContentConfig |
getDefaultOptionalContentConfig()
Gets the default OptionalContentConfig for the document.
|
boolean |
getDeleteOnClose()
The document is based on a temporary file that must be deleted when the document is closed or saved.
|
java.lang.String |
getFileName()
Get the filename associated with this Document, if it has a representation on disk.
|
java.util.List<Font> |
getFonts(int firstPage,
int lastPage)
Get all the fonts in the specified page range.
|
PDDocFormsType |
getFormsType()
Returns the document's Forms Type.
|
boolean |
getHasSignature()
The document contains a Digital Signature.
|
java.lang.String |
getInfo(java.lang.String infoname)
Gets the value of metadata information in a PDF file.
|
PDFDict |
getInfoDict()
The Info dictionary of the document as a PDFObject.
|
byte[] |
getInstanceID()
Get the instance ID for this document.
|
boolean |
getIsEmbedded()
The document is embedded in a compound document (OLE, OpenDoc).
|
boolean |
getIsLinearized()
The document is linearized (optimized) for page-served remote (network) access.
|
boolean |
getIsModified()
The document has been modified slightly (for example, bookmarks or text annotations have been opened or closed), but not in a way that warrants saving.
|
boolean |
getIsOptimized()
The document is optimized.
|
boolean |
getIsPxDF()
The underlying file is PxDF.
|
java.lang.String |
getKeywords()
The keywords of the PDF file.
|
java.util.List<Font> |
getLoadedFonts()
Enumerates all the fonts that have been encountered so far.
|
short |
getMajorVersion()
The major PDF version number of the document.
|
boolean |
getMajorVersionIsNewerThanCurrentLibrary()
The document's major version is newer than the current library version.
|
java.lang.String |
getMergedXMPKeywords()
A string containing a semicolon-separated list of fields.
|
short |
getMinorVersion()
The minor PDF version number of the document.
|
boolean |
getMinorVersionIsNewerThanCurrentLibrary()
The document's minor version is newer than the current library version.
|
NameTree |
getNameTree(java.lang.String nameTreeName)
Retrieves the name tree inside the Names dictionary with the specified key name.
|
boolean |
getNeedsSave()
The document has been modified and needs to be saved.
|
int |
getNumPages()
Gets the number of pages in a document.
|
java.util.List<OptionalContentConfig> |
getOptionalContentConfigs()
Gets all OptionalContentConfigs stored in this document.
|
OptionalContentContext |
getOptionalContentContext()
Gets the built-in default OptionalContentContext for the document.
|
java.util.List<OptionalContentGroup> |
getOptionalContentGroups()
Gets the optional-content groups for the document.
|
Page |
getPage(int pageNumber)
Gets a Page from a document.
|
java.util.List<PageLabel> |
getPageLabels()
The list of PageLabel objects used in the document.
|
PageMode |
getPageMode()
The PageMode of the PDF document.
|
byte[] |
getPermanentID()
Get the permanent ID for this document.
|
java.util.EnumSet<PermissionFlags> |
getPermissionFlags()
Allows to obtain security flags for the document.
|
java.lang.String |
getProducer()
The producer of the PDF file.
|
boolean |
getRequiresFullSave()
The document cannot be saved incrementally; when it is saved using Document.Save(), the SaveFlags.Full flag must be specified.
|
java.util.List<RolledBackDocument> |
getRolledBackDocuments()
A Document that have been previously saved Incrementally means changes were written to the end of the file leaving its original contents intact.
|
PDFDict |
getRoot()
The Catalog of the document as a PDFObject.
|
java.lang.String |
getSubject()
The subject of the PDF document.
|
boolean |
getSuppressErrors()
Do not display errors.
|
java.lang.String |
getTitle()
The title of the PDF document.
|
boolean |
getVersionIsOlderThanCurrentLibrary()
The document's version is older than the current library version.
|
java.lang.String |
getVersionString()
The PDF version of the document, which is specified in the header of a PDF file in the string "%PDF-xx.yy" where xx is the major version and yy is the minor version.
|
boolean |
getWasRepaired()
The document was repaired when it was opened.
|
java.lang.String |
getXMPMetadata()
The XMP metadata associated with a document.
|
java.lang.String |
getXMPMetadataArrayItem(java.lang.String namespaceName,
java.lang.String path,
int index)
Gets the value of an XMP metadata array item, associated with a document, based on an index.
|
java.lang.String |
getXMPMetadataProperty(java.lang.String namespaceName,
java.lang.String path)
Gets the value of an XMP metadata property associated with a document.
|
boolean |
importAcroFormsData(java.lang.String fileName,
AcroFormImportType importType)
Import the AcroForms data.
|
boolean |
importXFAFormsData(java.lang.String fileName)
Import the XFA Forms data.
|
void |
insertPages(int mergeAfterThisPage,
Document doc2,
int startPage,
int numPages,
java.util.EnumSet<PageInsertFlags> insertFlags)
Inserts numPages pages from doc2 into doc.
|
void |
insertPages(int mergeAfterThisPage,
Document doc2,
int startPage,
int numPages,
java.util.EnumSet<PageInsertFlags> insertFlags,
ProgressMonitor progressMonitor,
CancelProc cancelProc)
Inserts numPages pages from doc2 into doc.
|
boolean |
isDynamicXFA()
Indicates if the document is Dynamic XFA.
|
boolean |
isStaticXFA()
Indicates if the document is Static XFA.
|
void |
lookForKidsInNameTree(PDFDict nameTree,
java.util.List<FileAttachment> attachments) |
void |
mergeXMPKeywords()
Causes a string produced as by PDDocGetMergedXAPKeywords() to be stored as the new value of the pdf:Keywords property, and the former value of the pdf:Keywords property to be stored as an item in the xmp:Keywords bag of keyword items.
|
void |
movePage(int moveToAfterThisPage,
int pageToMove)
Moves one page in a document.
|
boolean |
permRequest(PermissionRequestOperation requestedperm)
Tests if a permission is set on a document
|
boolean |
permRequest(java.lang.String password,
PermissionRequestOperation perms)
Request the permissions to be changed on a PDF document.
|
void |
print(PrintUserParams userParams)
Prints a PDF document or pages from a PDF document allowing the caller to specify options such as page size, rotation, and shrink-to-fit.
|
void |
print(PrintUserParams userParams,
PrintCancelProc printCancelProc)
Prints a PDF document or pages from a PDF document allowing the caller to specify options such as page size, rotation, and shrink-to-fit.
|
void |
print(PrintUserParams userParams,
PrintCancelProc printCancelProc,
PrintProgressProc printProgressProc)
Prints a PDF document or pages from a PDF document allowing the caller to specify options such as page size, rotation, and shrink-to-fit.
|
void |
printToFile(PrintUserParams userParams,
PrintCancelProc printCancelProc,
PrintProgressProc printProgressProc,
java.lang.String path)
Prints a PDF document or pages from a PDF document allowing the caller to specify options such as page size, rotation, and shrink-to-fit.
|
void |
printToFile(PrintUserParams userParams,
PrintCancelProc printCancelProc,
java.lang.String path)
Prints a PDF document or pages from a PDF document allowing the caller to specify options such as page size, rotation, and shrink-to-fit.
|
void |
printToFile(PrintUserParams userParams,
java.lang.String path)
Prints a PDF document or pages from a PDF document allowing the caller to specify options such as page size, rotation, and shrink-to-fit.
|
void |
removeCollection()
RemoveCollection Removes a collection dictionary from a document.
|
void |
removeDuplicateOCG()
Removes duplicate optional content group from the document.
|
void |
removeNameTree(java.lang.String nameTreeName)
Removes the name tree inside the Names dictionary with the specified key name.
|
void |
removeOCG(OptionalContentGroup ocg)
Removes the specified optional content group from the document.
|
void |
replacePages(int startPage,
Document doc2,
int startPageDoc2,
int numPages,
boolean mergeTextAnnots)
Replaces the specified range of pages in one document with pages from another.
|
void |
save(java.util.EnumSet<SaveFlags> saveFlags)
Saves a document to disk.
|
void |
save(java.util.EnumSet<SaveFlags> saveFlags,
javax.imageio.stream.ImageOutputStream stream)
Saves a Document to a javax.imageio.stream.ImageOutputStream.
|
void |
save(java.util.EnumSet<SaveFlags> saveFlags,
javax.imageio.stream.ImageOutputStream stream,
ProgressMonitor progressMonitor,
CancelProc cancelProc) |
void |
save(java.util.EnumSet<SaveFlags> saveFlags,
com.datalogics.PDFL.JavaStreamFile dest) |
void |
save(java.util.EnumSet<SaveFlags> saveFlags,
com.datalogics.PDFL.JavaStreamFile dest,
ProgressMonitor progressMonitor,
CancelProc cancelProc) |
void |
save(java.util.EnumSet<SaveFlags> saveFlags,
ProgressMonitor progressMonitor,
CancelProc cancelProc)
Saves a document to disk.
|
void |
save(java.util.EnumSet<SaveFlags> saveFlags,
java.lang.String newPath)
Saves a document to disk.
|
void |
save(java.util.EnumSet<SaveFlags> saveFlags,
java.lang.String newPath,
ProgressMonitor progressMonitor,
CancelProc cancelProc)
Saves a document to disk.
|
void |
secure(java.util.EnumSet<PermissionFlags> permissions,
java.lang.String ownerPassword,
java.lang.String userPassword)
Secure the PDF document securely with password(s).
|
void |
secure(java.util.EnumSet<PermissionFlags> permissions,
java.lang.String ownerPassword,
java.lang.String userPassword,
EncryptionType encryptionType)
Secure the PDF document securely with password(s).
|
void |
secure(java.util.EnumSet<PermissionFlags> permissions,
java.lang.String ownerPassword,
java.lang.String userPassword,
EncryptionType encryptionType,
boolean encryptMetadata)
Secure the PDF document securely with password(s).
|
void |
setAuthor(java.lang.String authorvalue)
The author of the PDF document.
|
void |
setBaseURI(java.lang.String URIvalue)
The Base URI of the PDF document.
|
void |
setCreator(java.lang.String creatorvalue)
The creator of the PDF document.
|
void |
setDeleteOnClose(boolean value)
The document is based on a temporary file that must be deleted when the document is closed or saved.
|
void |
setInfo(java.lang.String infoname,
java.lang.String infovalue)
Sets metadata information in a PDF document.
|
void |
setIsEmbedded(boolean value)
The document is embedded in a compound document (OLE, OpenDoc).
|
void |
setIsOptimized(boolean value)
The document is optimized.
|
void |
setKeywords(java.lang.String keywordsvalue)
The keywords of the PDF document.
|
void |
setMajorVersion(short majorVersion)
The major PDF version number of the document.
|
void |
setMinorVersion(short minorVersion)
The minor PDF version number of the document.
|
void |
setNeedsSave(boolean value)
The document has been modified and needs to be saved.
|
void |
setPageLabels(java.util.List<PageLabel> arg0)
The list of PageLabel objects used in the document.
|
void |
setPageMode(PageMode pagemode)
The PageMode of the PDF document.
|
void |
setProducer(java.lang.String producervalue)
The producer of the PDF document.
|
void |
setRequiresFullSave(boolean value)
The document cannot be saved incrementally; when it is saved using Document.Save(), the SaveFlags.Full flag must be specified.
|
void |
setSubject(java.lang.String subjectvalue)
The subject of the PDF document.
|
void |
setSuppressErrors(boolean value)
Do not display errors.
|
void |
setTitle(java.lang.String titlevalue)
The title of the PDF document.
|
void |
setXMPMetadata(java.lang.String metadata)
The XMP metadata associated with a document.
|
void |
setXMPMetadataArrayItem(java.lang.String namespaceName,
java.lang.String namespacePrefix,
java.lang.String path,
int index,
java.lang.String newValue)
Sets the value of an XMP metadata array item, associated with a document, based on an index.
|
void |
setXMPMetadataProperty(java.lang.String namespaceName,
java.lang.String namespacePrefix,
java.lang.String path,
java.lang.String newValue)
Sets the value of an XMP metadata property associated with a document.
|
void |
unsecure()
Remove security handler from the PDF document.
|
void |
watermark(Page page,
WatermarkParams watermarkParams)
Adds a Page as a watermark to a page range in the given document.
|
void |
watermark(WatermarkTextParams watermarkTextParams,
WatermarkParams watermarkParams)
Adds a text-based watermark to a page range in the given document.
|
public static final int BEFORE_FIRST_PAGE
public static final int LAST_PAGE
public static final int ALL_PAGES
public Document(javax.imageio.stream.ImageInputStream stream)
throws java.io.IOException
stream - The stream from which to read the Document.java.io.IOExceptionpublic Document(javax.imageio.stream.ImageInputStream stream,
java.lang.String password,
PermissionRequestOperation perms,
boolean doRepair)
throws java.io.IOException
stream - The stream from which to read the Document.password - The password to use to attempt to open the document.perms - The permissions being requested. It must be an OR of the PermissionRequestOperation values.doRepair - If true, attempt to repair the file if it is damaged. If false, do not attempt to repair the file if it is damaged.java.io.IOExceptionpublic Document()
public Document(java.lang.String fileName)
fileName - A path name to the file, specified in whatever format is correct for fileSys.public Document(java.lang.String fileName,
java.lang.String password,
PermissionRequestOperation perms,
boolean doRepair)
fileName - A path name to the file.password - The password to use to attempt to open the document.perms - The permissions being requested. It must be an OR of the PermissionRequestOperation values.doRepair - If true, attempt to repair the file if it is damaged. If false, do not attempt to repair the file if it is damaged.public Document(java.lang.String XPSFilename,
XPSConvertParams ConversionParams)
Documents are converted one at a time. In multi-threaded applications, threads that are making simultaneous calls to this method will block and execute the method sequentially.
NOTE: This method is only available on Windows or Linux.
XPSFilename - The path to the XPS file to convert.ConversionParams - Additional parameters for XPS conversion.public Document(com.datalogics.PDFL.JavaStreamFile file)
public Document(com.datalogics.PDFL.JavaStreamFile file,
java.lang.String password,
PermissionRequestOperation perms,
boolean doRepair)
public void delete()
public void save(java.util.EnumSet<SaveFlags> saveFlags, javax.imageio.stream.ImageOutputStream stream) throws java.io.IOException
saveFlags - An enum of SaveFlags values.stream - The stream to which the file is saved.java.io.IOExceptionpublic void save(java.util.EnumSet<SaveFlags> saveFlags, javax.imageio.stream.ImageOutputStream stream, ProgressMonitor progressMonitor, CancelProc cancelProc) throws java.io.IOException
java.io.IOExceptionpublic PDFAConvertResult cloneAsPDFADocument(PDFAConvertType type, PDFAConvertParams parms)
type - The type of PDF/A conversion to performparms - A PDFAConvertParams object specifying options for the conversionpublic PDFXConvertResult cloneAsPDFXDocument(PDFXConvertType type, PDFXConvertParams parms)
type - The type of PDF/X conversion to performparms - A PDFXConvertParams object specifying options for the conversionpublic java.lang.String getFileName()
public void save(java.util.EnumSet<SaveFlags> saveFlags, java.lang.String newPath)
If the document was created with Document, at least one page must be added using CreatePage() or InsertPages() before a PDF Viewer can save the document.
A full save with linearization optimizes the PDF file. During optimization, all objects in a PDF file are rearranged, many of them acquiring not only a new file position, but also a new PDFObject number. At the end of the save operation, PDFL flushes its information of the PD layer and below to synchronize its in-memory state with the new disk file just written.
If the document has a signature, it will be saved incrementally regardless of the full save flag. This is required to preserve the exact contents of the document at the time of signing.
saveFlags - A bit field composed of an OR of the SaveFlags values.newPath - The path to which the file is saved. A path must be specified when either SaveFlags.Full or SaveFlags.Copy are used for saveFlags. If SaveFlags.Incremental is specified in saveFlags, then newPath should be NULL. If SaveFlags.Full is specified and newPath is the same as the file's original path, the new file is saved to a file system-determined temporary path, then the old file is deleted and the new file is renamed to newPath.public void save(java.util.EnumSet<SaveFlags> saveFlags, java.lang.String newPath, ProgressMonitor progressMonitor, CancelProc cancelProc)
If the document was created with Document, at least one page must be added using CreatePage() or InsertPages() before a PDF Viewer can save the document.
A full save with linearization optimizes the PDF file. During optimization, all objects in a PDF file are rearranged, many of them acquiring not only a new file position, but also a new PDFObject number. At the end of the save operation, PDFL flushes its information of the PD layer and below to synchronize its in-memory state with the new disk file just written.
If the document has a signature, it will be saved incrementally regardless of the full save flag. This is required to preserve the exact contents of the document at the time of signing.
saveFlags - A bit field composed of an OR of the SaveFlags values.newPath - The path to which the file is saved. A path must be specified when either SaveFlags.Full or SaveFlags.Copy are used for saveFlags. If SaveFlags.Incremental is specified in saveFlags, then newPath should be NULL. If SaveFlags.Full is specified and newPath is the same as the file's original path, the new file is saved to a file system-determined temporary path, then the old file is deleted and the new file is renamed to newPath.progressMonitor - a ProgressMonitor that will receive progress information, may be nullcancelProc - a CancelProc, which can return true to cancel the operation, may be nullpublic void save(java.util.EnumSet<SaveFlags> saveFlags)
A full save with linearization optimizes the PDF file. During optimization, all objects in a PDF file are rearranged, many of them acquiring not only a new file position, but also a new PDFObject number. At the end of the save operation, PDFL flushes its information of the PD layer and below to synchronize its in-memory state with the new disk file just written.
If the document has a signature, it will be saved incrementally regardless of the full save flag. This is required to preserve the exact contents of the document at the time of signing.
saveFlags - A bit field composed of an OR of the SaveFlags values.public void save(java.util.EnumSet<SaveFlags> saveFlags, ProgressMonitor progressMonitor, CancelProc cancelProc)
A full save with linearization optimizes the PDF file. During optimization, all objects in a PDF file are rearranged, many of them acquiring not only a new file position, but also a new PDFObject number. At the end of the save operation, PDFL flushes its information of the PD layer and below to synchronize its in-memory state with the new disk file just written.
If the document has a signature, it will be saved incrementally regardless of the full save flag. This is required to preserve the exact contents of the document at the time of signing.
progressMonitor - a ProgressMonitor that will receive progress information, may be nullcancelProc - a CancelProc, which can return true to cancel the operation, may be nullsaveFlags - A bit field composed of an OR of the SaveFlags values.public void save(java.util.EnumSet<SaveFlags> saveFlags, com.datalogics.PDFL.JavaStreamFile dest, ProgressMonitor progressMonitor, CancelProc cancelProc)
public void save(java.util.EnumSet<SaveFlags> saveFlags, com.datalogics.PDFL.JavaStreamFile dest)
public java.util.EnumSet<PermissionFlags> getPermissionFlags()
public void secure(java.util.EnumSet<PermissionFlags> permissions, java.lang.String ownerPassword, java.lang.String userPassword)
The document must be saved for the changes to take effect. A full save is required.
permissions - an "OR" of the types of PDF document specified by Permissions:ownerPassword - optional PDF document owner password; pass null if not used.userPassword - optional PDF document user password; pass null if not used.public void secure(java.util.EnumSet<PermissionFlags> permissions, java.lang.String ownerPassword, java.lang.String userPassword, EncryptionType encryptionType)
The document must be saved for the changes to take effect. A full save is required.
permissions - an "OR" of the types of PDF document specified by Permissions:ownerPassword - optional PDF document owner password; pass null if not used.userPassword - optional PDF document user password; pass null if not used.encryptionType - Encryption type to be used for securing the document.public void secure(java.util.EnumSet<PermissionFlags> permissions, java.lang.String ownerPassword, java.lang.String userPassword, EncryptionType encryptionType, boolean encryptMetadata)
The document must be saved for the changes to take effect. A full save is required.
permissions - an "OR" of the types of PDF document specified by Permissions:ownerPassword - optional PDF document owner password; pass null if not used.userPassword - optional PDF document user password; pass null if not used.encryptionType - Encryption type to be used for securing the document.encryptMetadata - A flag that indicates whether document metadata will be encrypted.public void unsecure()
To remove the security handler, you must hold the PermissionRequestOperation.Secure permission, which you can obtain via Document.PermRequest. This call will throw an ApplicationException if you do not hold the Secure permission.
The document must be saved for the changes to take effect. A full save is required.
public boolean permRequest(java.lang.String password,
PermissionRequestOperation perms)
password - The document password which authorizes the change. Note - if this argument is set to a NULL (""), then the return will be an indicator of whether or not the requested permission is already set in this document, with no changes made to the PDF document.perms - the permissions on the PDF file which is to be set or checked.public boolean permRequest(PermissionRequestOperation requestedperm)
requestedperm - The document permission which to checkpublic void close()
Documentpublic void embedFonts()
To keep the changes the document must be saved. Fonts on the user's system that match the original font definition will be embedded. For the Times-Roman and Helvetica and corresponding styles, if displayed with a font alias, then the font alias will be embedded in the file. If the font has information that indicates the font cannot be embedded for print and preview, then the font will not be embedded in the document.
With no flags, fonts marked as embedded or subsettable will be embedded.
By default, the font embedding process scans the entire document for font usage information when subsetting fonts. For documents with large numbers of fonts or pages, this can take a long time. In cases where new Font objects are created and used to set text, it's not necessary to scan the entire document; instead, use the version of this call that takes a list of Font objects and a set of flags for embedding. Passing the list of new Fonts and the DontScanDocument flag will directly embed the fonts in the list without scanning the document.
public void embedFonts(java.util.EnumSet<EmbedFlags> flags)
To keep the changes the document must be saved. Fonts on the user's system that match the original font definition will be embedded. For the Times-Roman and Helvetica and corresponding styles, if displayed with a font alias, then the font alias will be embedded in the file. If the font has information that indicates the font cannot be embedded for print and preview, then the font will not be embedded in the document.
By default, the font embedding process scans the entire document for font usage information when subsetting fonts. For documents with large numbers of fonts or pages, this can take a long time. In cases where new Font objects are created and used to set text, it's not necessary to scan the entire document; instead, use the version of this call that takes a list of Font objects and a set of flags for embedding. Passing the list of new Fonts and the DontScanDocument flag will directly embed the fonts in the list without scanning the document.
flags - One of the EmbedFlagspublic void embedFonts(java.util.EnumSet<EmbedFlags> flags, ProgressMonitor progressMonitor, CancelProc cancelProc, ReportProc reportProc)
To keep the changes the document must be saved. Fonts on the user's system that match the original font definition will be embedded. For the Times-Roman and Helvetica and corresponding styles, if displayed with a font alias, then the font alias will be embedded in the file. If the font has information that indicates the font cannot be embedded for print and preview, then the font will not be embedded in the document.
By default, the font embedding process scans the entire document for font usage information when subsetting fonts. For documents with large numbers of fonts or pages, this can take a long time. In cases where new Font objects are created and used to set text, it's not necessary to scan the entire document; instead, use the version of this call that takes a list of Font objects and a set of flags for embedding. Passing the list of new Fonts and the DontScanDocument flag will directly embed the fonts in the list without scanning the document.
flags - One of the EmbedFlagsprogressMonitor - a ProgressMonitor that will receive progress information, may be nullcancelProc - a CancelProc, which can return true to cancel the operation, may be nullreportProc - a ReportProc, which will be called with warnings about fonts that do not embed, may be nullpublic void embedFonts(java.util.List<Font> fonts)
To keep the changes the document must be saved. Fonts on the user's system that match the original font definition will be embedded. For the Times-Roman and Helvetica and corresponding styles, if displayed with a font alias, then the font alias will be embedded in the file. If the font has information that indicates the font cannot be embedded for print and preview, then the font will not be embedded in the document.
The fonts passed to this function must be fonts actually used in the current document. These fonts may be obtained by using the GetFonts or GetLoadedFonts functions, or obtained from a TextRun. Fonts created by name will not work in this context.
By default, the font embedding process scans the entire document for font usage information when subsetting fonts. For documents with large numbers of fonts or pages, this can take a long time. In cases where new Font objects are created and used to set text, it's not necessary to scan the entire document; instead, use the version of this call that takes a list of Font objects and a set of flags for embedding. Passing the list of new Fonts and the DontScanDocument flag will directly embed the fonts in the list without scanning the document.
public void embedFonts(java.util.List<Font> fonts, java.util.EnumSet<EmbedFlags> flags)
To keep the changes the document must be saved. Fonts on the user's system that match the original font definition will be embedded. For the Times-Roman and Helvetica and corresponding styles, if displayed with a font alias, then the font alias will be embedded in the file. If the font has information that indicates the font cannot be embedded for print and preview, then the font will not be embedded in the document.
The fonts passed to this function must be fonts actually used in the current document. These fonts may be obtained by using the GetFonts or GetLoadedFonts functions, or obtained from a TextRun. Fonts created by name will not work in this context.
By default, the font embedding process scans the entire document for font usage information when subsetting fonts. For documents with large numbers of fonts or pages, this can take a long time. In cases where new Font objects are created and used to set text, it's not necessary to scan the entire document; instead, pass the list of new Fonts and the DontScanDocument flag. This will directly embed the fonts in the list without scanning the document.
fonts - The list of fonts to embed. See restrictions above.flags - One of the EmbedFlagspublic void embedFonts(java.util.List<Font> fonts, java.util.EnumSet<EmbedFlags> flags, ProgressMonitor progressMonitor, CancelProc cancelProc, ReportProc reportProc)
To keep the changes the document must be saved. Fonts on the user's system that match the original font definition will be embedded. For the Times-Roman and Helvetica and corresponding styles, if displayed with a font alias, then the font alias will be embedded in the file. If the font has information that indicates the font cannot be embedded for print and preview, then the font will not be embedded in the document.
The fonts passed to this function must be fonts actually used in the current document. These fonts may be obtained by using the GetFonts or GetLoadedFonts functions, or obtained from a TextRun. Fonts created by name will not work in this context.
By default, the font embedding process scans the entire document for font usage information when subsetting fonts. For documents with large numbers of fonts or pages, this can take a long time. In cases where new Font objects are created and used to set text, it's not necessary to scan the entire document; instead, pass the list of new Fonts and the DontScanDocument flag. This will directly embed the fonts in the list without scanning the document.
fonts - The list of fonts to embed. See restrictions above.flags - One of the EmbedFlagsprogressMonitor - a ProgressMonitor that will receive progress information, may be nullcancelProc - a CancelProc, which can return true to cancel the operation, may be nullreportProc - a ReportProc, which will be called with warnings about fonts that do not embed, may be nullpublic void embedOCRFonts()
This is also done automatically when saving.
public void print(PrintUserParams userParams)
userParams - Parameters to control printing.public void print(PrintUserParams userParams, PrintCancelProc printCancelProc)
userParams - Parameters to control printing.printCancelProc - A PrintCancelProc, which can return true to cancel printing, may be null.public void print(PrintUserParams userParams, PrintCancelProc printCancelProc, PrintProgressProc printProgressProc)
userParams - Parameters to control printing.printCancelProc - A PrintCancelProc, which can return true to cancel printing, may be null.printProgressProc - A PrintProgressProc, may be null.public void printToFile(PrintUserParams userParams, java.lang.String path)
The output is placed in the specified file.
userParams - Parameters to control printing.path - The output file to be created.public void printToFile(PrintUserParams userParams, PrintCancelProc printCancelProc, java.lang.String path)
The output is placed in the specified file.
userParams - Parameters to control printing.path - The output file to be created.printCancelProc - A PrintCancelProc, which can return true to cancel printing, may be null.public void printToFile(PrintUserParams userParams, PrintCancelProc printCancelProc, PrintProgressProc printProgressProc, java.lang.String path)
The output is placed in the specified file.
userParams - Parameters to control printing.path - The output file to be created.printCancelProc - A PrintCancelProc, which can return true to cancel printing, may be null.printProgressProc - A PrintProgressProc, may be null.public void exportAsPostScript(PrintUserParams userParams, java.lang.String path)
The output is placed in the specified file.
userParams - Parameters to control printing.path - The output file to be created.public void exportAsPostScript(PrintUserParams userParams, PrintCancelProc printCancelProc, java.lang.String path)
The output is placed in the specified file.
userParams - Parameters to control printing.path - The output file to be created.printCancelProc - A PrintCancelProc, which can return true to cancel printing, may be null.public void exportAsPostScript(PrintUserParams userParams, PrintCancelProc printCancelProc, PrintProgressProc printProgressProc, java.lang.String path)
The output is placed in the specified file.
userParams - Parameters to control printing.path - The output file to be created.printCancelProc - A PrintCancelProc, which can return true to cancel printing, may be null.printProgressProc - A PrintProgressProc, may be null.public int getNumPages()
public Page getPage(int pageNumber)
pageNumber - The page number of the page to acquire. The first page is 0.public Page createPage(int afterPageNum, Rect mediaBox)
afterPageNum - The page number after which the new page is inserted. The first page is 0. Use Document.BeforeFirstPage to insert the new page at the beginning of a document.mediaBox - A rectangle specifying the page's media box, specified in user space coordinates.public void movePage(int moveToAfterThisPage,
int pageToMove)
moveToAfterThisPage - The new location of the page to move. The first page is 0. It may either be a page number, or the constant Document.BeforeFirstPage.pageToMove - The page number of the page to move.public void insertPages(int mergeAfterThisPage,
Document doc2,
int startPage,
int numPages,
java.util.EnumSet<PageInsertFlags> insertFlags)
The insertFlags parameter controls whether bookmarks and threads are inserted along with the specified pages. Setting this parameter to PageInsertFlags.All has two effects:
The parameters indicating which pages to insert are ignored: all the pages of doc2 are inserted.
In addition to inserting the pages themselves, it also merges other document data from doc2 into doc:
Named destinations from doc2 (of PDF 1.1 and later) are copied into doc. If there are named destinations in doc2 with the same name as some named destination in doc, the ones in doc retain their names and the copied named destinations are given new names based on the old ones, with distinguishing digits added. Actions and bookmarks referring to the old names are made to refer to the new names after being copied into doc.
If it is also the case that mergeAfterThisPage denotes the last page of the document, then document metadata is merged, and the optional content properties are merged in a more symmetrical manner than would otherwise be the case.
Document logical structure from doc2 is copied into doc. If less than the whole of doc2 is being inserted, only those structure elements having content on the copied pages, and the ancestors of those elements, are copied into the logical structure tree of doc. The top-level children of the structure tree root of doc2 are copied as new top-level children of the structure tree root of doc; a structure tree root is created in doc if there was none before. The role maps of the two structure trees are merged, with name conflicts resolved in favor of the role mappings present in doc. Attribute objects having scalar values, or values that are arrays of scalar values, are copied. Class map information from doc2 is also merged into that for doc.
mergeAfterThisPage - The page number in doc after which pages from doc2 are inserted. The first page is 0. If Document.BeforeFirstPage is used, the pages are inserted before the first page in doc. Use Document.LastPage to insert pages after the last page in doc.doc2 - The document containing the pages that are inserted into doc.startPage - The page number of the first page in doc2 to insert into doc. The first page is 0.numPages - The number of pages in doc2 to insert into doc. Use Document.AllPages to insert all pages from doc2 into doc.insertFlags - Flags that determine what additional information is copied from doc2 into doc. It is an OR of the following constants: PageInsertFlags.Bookmarks, PageInsertFlags.Threads, PageInsertFlags.Allpublic void insertPages(int mergeAfterThisPage,
Document doc2,
int startPage,
int numPages,
java.util.EnumSet<PageInsertFlags> insertFlags,
ProgressMonitor progressMonitor,
CancelProc cancelProc)
The insertFlags parameter controls whether bookmarks and threads are inserted along with the specified pages. Setting this parameter to PageInsertFlags.All has two effects:
The parameters indicating which pages to insert are ignored: all the pages of doc2 are inserted.
In addition to inserting the pages themselves, it also merges other document data from doc2 into doc:
Named destinations from doc2 (of PDF 1.1 and later) are copied into doc. If there are named destinations in doc2 with the same name as some named destination in doc, the ones in doc retain their names and the copied named destinations are given new names based on the old ones, with distinguishing digits added. Actions and bookmarks referring to the old names are made to refer to the new names after being copied into doc.
If it is also the case that mergeAfterThisPage denotes the last page of the document, then document metadata is merged, and the optional content properties are merged in a more symmetrical manner than would otherwise be the case.
Document logical structure from doc2 is copied into doc. If less than the whole of doc2 is being inserted, only those structure elements having content on the copied pages, and the ancestors of those elements, are copied into the logical structure tree of doc. The top-level children of the structure tree root of doc2 are copied as new top-level children of the structure tree root of doc; a structure tree root is created in doc if there was none before. The role maps of the two structure trees are merged, with name conflicts resolved in favor of the role mappings present in doc. Attribute objects having scalar values, or values that are arrays of scalar values, are copied. Class map information from doc2 is also merged into that for doc.
mergeAfterThisPage - The page number in doc after which pages from doc2 are inserted. The first page is 0. If Document.BeforeFirstPage is used, the pages are inserted before the first page in doc. Use Document.LastPage to insert pages after the last page in doc.doc2 - The document containing the pages that are inserted into doc.startPage - The page number of the first page in doc2 to insert into doc. The first page is 0.numPages - The number of pages in doc2 to insert into doc. Use Document.AllPages to insert all pages from doc2 into doc.insertFlags - Flags that determine what additional information is copied from doc2 into doc. It is an OR of the following constants: PageInsertFlags.Bookmarks, PageInsertFlags.Threads, PageInsertFlags.AllprogressMonitor - a ProgressMonitor that will receive progress information, may be nullcancelProc - a CancelProc, which can return true to cancel the operation, may be nullpublic void replacePages(int startPage,
Document doc2,
int startPageDoc2,
int numPages,
boolean mergeTextAnnots)
startPage - The first page number in doc to replace. The first page is 0.doc2 - The document from which pages are copied into doc.startPageDoc2 - The page number of the first page in doc2 to copy. The first page is 0.numPages - The number of pages to replace.mergeTextAnnots - If true, text annotations from doc2 are appended if they are different than all existing annotations on the page in doc. No other types of annotations are copied.public void deletePages(int firstPage,
int lastPage)
firstPage - The page number of the first page to delete. The first page is 0.lastPage - The page number of the last page to delete.public void deletePages(int firstPage,
int lastPage,
java.util.EnumSet<PageDeleteFlags> deleteFlags)
firstPage - The page number of the first page to delete. The first page is 0.lastPage - The page number of the last page to delete.deleteFlags - One of the DeleteFlags.public void removeDuplicateOCG()
public void removeOCG(OptionalContentGroup ocg)
ocg - The optional content group to remove.public java.util.List<Font> getFonts(int firstPage, int lastPage)
firstPage - The page number of the first page for which fonts are enumerated. The first page is 0.lastPage - The page number of the last page for which fonts are enumerated.public java.util.List<Font> getLoadedFonts()
public java.util.List<PageLabel> getPageLabels()
PageLabels are always stored in page index order; if two PageLabels start on the same page index, the last PageLabel appearing in the list will be used.
public void setPageLabels(java.util.List<PageLabel> arg0)
public java.lang.String findLabelForPageNum(int pageIndex)
pageIndex - Index of a page in the Documentpublic int findPageNumForLabel(java.lang.String label)
label - The label string to look uppublic void watermark(Page page, WatermarkParams watermarkParams)
page - The page to be added as a watermark.watermarkParams - Structure specifying how the watermark should be added to the document.public void watermark(WatermarkTextParams watermarkTextParams, WatermarkParams watermarkParams)
watermarkTextParams - Structure describing the text-based watermark to be added.watermarkParams - Structure specifying how the watermark should be added to the document.public Bookmark getBookmarkRoot()
public java.util.List<OptionalContentGroup> getOptionalContentGroups()
public OptionalContentContext getOptionalContentContext()
public OptionalContentConfig getDefaultOptionalContentConfig()
public java.util.List<OptionalContentConfig> getOptionalContentConfigs()
Any OptionalContentConfigs created via the OptionalContentConfig constructor will appear in this list.
public void setInfo(java.lang.String infoname,
java.lang.String infovalue)
infoname - The name of metadata to be setinfovalue - The value for metadata which will be setpublic void setTitle(java.lang.String titlevalue)
public void setSubject(java.lang.String subjectvalue)
public void setAuthor(java.lang.String authorvalue)
public void setKeywords(java.lang.String keywordsvalue)
public void setCreator(java.lang.String creatorvalue)
public void setProducer(java.lang.String producervalue)
public void setBaseURI(java.lang.String URIvalue)
public void setPageMode(PageMode pagemode)
The default PageMode for a new Document is PageMode.NoPreference .
pagemode - the pagemode to apply to the Documentpublic java.lang.String getInfo(java.lang.String infoname)
infoname - The name of metadata which value will be obtained.public java.lang.String getTitle()
public java.lang.String getSubject()
public java.lang.String getAuthor()
public java.lang.String getKeywords()
public java.lang.String getCreator()
public java.lang.String getProducer()
public java.lang.String getBaseURI()
public PageMode getPageMode()
public PDFDict getInfoDict()
public PDFDict getRoot()
public int getCompressionLevel()
The compression level can be one of three values returned by this property:
0 - No compression. All objects are available without inflation.
1 - Partial compression. Objects related to logical structure are stored in object streams and must be inflated.
2 - Full compression. All objects are compressed and must be inflated.
public byte[] getPermanentID()
public byte[] getInstanceID()
public PDFObject findPDFObjectByID(int ID)
public Bookmark findBookmark(java.lang.String title, int maxDepth)
title - The title of the bookmark for which to search.maxDepth - If supplied (with a value greater than or equal to 0), declares the number of levels below this bookmark to search. (If omitted, the entire subtree is searched.)public Bookmark findBookmark(java.lang.String title)
title - The title of the bookmark for which to search.public boolean enumIndirectPDFObjects(PDFObjectEnumProc enumProc)
The objects are enumerated in no particular order. Successive enumerations of the same Document are not guaranteed to enumerate objects in the same order.
This method does not enumerate invalid objects, which include objects that are defined as null, objects that are not defined at all (those having no cross-reference entry), and objects that are on the free list.
This re-raises any exception that proc raises.
enumProc - A user-supplied callback to call for each indirect object in dP. Enumeration ends when enumProc returns false or all indirect objects have been enumerated. The value parameter returned in enumProc is always null.public NameTree createNameTree(java.lang.String nameTreeName)
nameTreeName - The name of the NameTree to create.public NameTree getNameTree(java.lang.String nameTreeName)
nameTreeName - The name of the NameTree to get.public void removeNameTree(java.lang.String nameTreeName)
nameTreeName - The name of the NameTree to remove.public java.util.List<FileAttachment> getAttachments()
public Collection getCollection()
public void createCollection()
public void removeCollection()
public java.lang.String getXMPMetadata()
The XMP metadata returned always represents all the properties in the Document's Info dictionary, and can also contain properties not present in the Info dictionary. This call is preferred to GetInfo, which only returns properties that are in the Info dictionary (although the older function is supported for compatibility).
public void setXMPMetadata(java.lang.String metadata)
The XMP metadata returned always represents all the properties in the Document's Info dictionary, and can also contain properties not present in the Info dictionary. This call is preferred to GetInfo, which only returns properties that are in the Info dictionary (although the older function is supported for compatibility).
public java.lang.String getXMPMetadataProperty(java.lang.String namespaceName,
java.lang.String path)
namespaceName - The XML namespace URI for the schema in which the property is to be found.path - The name of the desired simple property. Note that XMP properties can have an XML substructure; this method can only retrieve values from simple textual properties.public void setXMPMetadataProperty(java.lang.String namespaceName,
java.lang.String namespacePrefix,
java.lang.String path,
java.lang.String newValue)
namespaceName - The XML namespace URI for the schema in which the property is to be found.namespacePrefix - A brief string to be used as an abbreviation when creating the XML representation of the property. This string must not be empty.path - The name of the simple property to be modified.newValue - The new XML text value for the property.public int countXMPMetadataArrayItems(java.lang.String namespaceName,
java.lang.String path)
namespaceName - The XML namespace URI for the schema in which the property is to be found.path - The name of the simple property .public java.lang.String getXMPMetadataArrayItem(java.lang.String namespaceName,
java.lang.String path,
int index)
namespaceName - The XML namespace URI for the schema in which the property is to be found.path - The name of the desired simple property.index - The index in the metadata property array associated with the property.public void setXMPMetadataArrayItem(java.lang.String namespaceName,
java.lang.String namespacePrefix,
java.lang.String path,
int index,
java.lang.String newValue)
namespaceName - The XML namespace URI for the schema in which the property is to be found.namespacePrefix - A brief string to be used as an abbreviation when creating the XML representation of the property. This string must not be empty.path - The name of the simple property to be modified.index - The index in the metadata property array associated with the property.newValue - The new XML text value for the property.public java.lang.String getMergedXMPKeywords()
public void mergeXMPKeywords()
The algorithm used to compute merged keywords lists detects the case in which the keywords lists have already been merged and makes no changes to the XMP metadata in this case.
public void setNeedsSave(boolean value)
value - The NeedSave propertypublic boolean getNeedsSave()
public void setRequiresFullSave(boolean value)
value - The RequiresFullSave propertypublic boolean getRequiresFullSave()
public boolean getIsModified()
public void setDeleteOnClose(boolean value)
value - The DeleteOnClose propertypublic boolean getDeleteOnClose()
public boolean getWasRepaired()
public boolean getMajorVersionIsNewerThanCurrentLibrary()
public boolean getMinorVersionIsNewerThanCurrentLibrary()
public boolean getVersionIsOlderThanCurrentLibrary()
public void setSuppressErrors(boolean value)
value - The SuppressErrors propertypublic boolean getSuppressErrors()
public void setIsEmbedded(boolean value)
value - The IsEmbedded propertypublic boolean getIsEmbedded()
public boolean getIsLinearized()
public void setIsOptimized(boolean value)
value - The IsOptimized propertypublic boolean getIsOptimized()
public boolean getIsPxDF()
public java.lang.String getVersionString()
Note that this returns a string containing both the major and minor versions. For version comparisons, use MajorVersion and MinorVersion.
public short getMajorVersion()
public short getMinorVersion()
Please note: Setting the minor version on a document only changes the version number in the document's file header. It will NOT actually change the PDF's contents and it will NOT alter the PDF to conform to the standard of the new minor version.
The new minor version number will appear in the file header once the document is saved.
public void setMinorVersion(short minorVersion)
Please note: Setting the minor version on a document only changes the version number in the document's file header. It will NOT actually change the PDF's contents and it will NOT alter the PDF to conform to the standard of the new minor version.
The new minor version number will appear in the file header once the document is saved.
minorVersion - The new minor version number to be set in the document's file header.public void setMajorVersion(short majorVersion)
Please note: Setting the major version on a document only changes the version number in the document's file header. It will NOT actually change the PDF's contents and it will NOT alter the PDF to conform to the standard of the new major version.
The new major version number will appear in the file header once the document is saved.
majorVersion - The new major version number to be set in the document's file header.public boolean applyRedactions(Redaction redact)
public boolean applyRedactions()
public int flattenTransparency()
Documents are flattened one at a time. In multi-threaded applications, threads that are making simultaneous calls to this method will block and execute the method sequentially.
public int flattenTransparency(FlattenTransparencyParams params)
Documents are flattened one at a time. In multi-threaded applications, threads that are making simultaneous calls to this method will block and execute the method sequentially.
params - Additional parameters for performing transparency flattening.public int flattenTransparency(FlattenTransparencyParams params, int firstPage, int lastPage)
Documents are flattened one at a time. In multi-threaded applications, threads that are making simultaneous calls to this method will block and execute the method sequentially.
params - Additional parameters for performing transparency flattening.firstPage - The first page of the range of pages to flatten.lastPage - The last page of the range of pages to flatten.public boolean flattenOptionalContent()
Every page in the document will be replaced with a version that has no optional content. The new version of the page will contain only what was visible on the page when the call was made. All other optional content information will be removed from the document.
The document's default optional content context will be used to determine visibility of optional content.
public boolean flattenOptionalContent(OptionalContentContext occ)
Every page in the document will be replaced with a version that has no optional content. The new version of the page will contain only what was visible on the page when the call was made. All other optional content information will be removed from the document.
occ - The optional content context in which content is checked for visibility.public boolean colorConvertPages(ColorConvertParams params)
public boolean getHasSignature()
public void collectNamesOfTree(PDFArray namesArray, java.util.List<FileAttachment> attachments)
public void lookForKidsInNameTree(PDFDict nameTree, java.util.List<FileAttachment> attachments)
public java.util.List<RolledBackDocument> getRolledBackDocuments()
public static boolean convertToWord(java.lang.String inputPDFFileFilePath,
java.lang.String outputOfficeFilePath)
NOTE: This method is only available on Windows 32/64-bit and Linux 64-bit.
inputPDFFileFilePath - The PDF file path to convert.outputOfficeFilePath - The output Office file path.public static boolean convertToExcel(java.lang.String inputPDFFileFilePath,
java.lang.String outputOfficeFilePath)
NOTE: This method is only available on Windows 32/64-bit and Linux 64-bit.
inputPDFFileFilePath - The PDF file path to convert.outputOfficeFilePath - The output Office file path.public static boolean convertToPowerPoint(java.lang.String inputPDFFileFilePath,
java.lang.String outputOfficeFilePath)
NOTE: This method is only available on Windows 32/64-bit and Linux 64-bit.
inputPDFFileFilePath - The PDF file path to convert.outputOfficeFilePath - The output Office file path.public long flattenXFAFormFields()
https://www.datalogics.com/pdf-form-functions.
public void flattenAcroFormFields()
NOTE: This method is part of the APDFL Forms Extension that is available separately from APDFL. For more information, please see https://www.datalogics.com/pdf-form-functions.
public long convertXFAFieldsToAcroFormFields()
https://www.datalogics.com/pdf-form-functions.
public boolean exportXFAFormsData(java.lang.String fileName,
XFAFormExportType exportType)
https://www.datalogics.com/pdf-form-functions.
fileName - The path on disk of the file the XFA form data is exported to.exportType - The format type the XFA data should be exported to. The supported types are XDP, XML, and XFD.public boolean importXFAFormsData(java.lang.String fileName)
https://www.datalogics.com/pdf-form-functions.
fileName - The path on disk of the XFA form data file to be imported, the supported types of data that can be imported are XDP, XML, and XFD.public boolean exportAcroFormsData(java.lang.String fileName,
AcroFormExportType exportType)
https://www.datalogics.com/pdf-form-functions.
fileName - The path on disk of the file the AcroForms data is exported to.exportType - The format type the AcroForm data should be exported to. The supported types are XFDF, FDF, and XML.public boolean importAcroFormsData(java.lang.String fileName,
AcroFormImportType importType)
https://www.datalogics.com/pdf-form-functions.
fileName - The path on disk of the AcroFormsdata file to be imported.importType - The format type the data type should be imported to. The supported types are XFDF, FDF, and XML.public boolean isDynamicXFA()
https://www.datalogics.com/pdf-form-functions.
public boolean isStaticXFA()
https://www.datalogics.com/pdf-form-functions.
public long flattenXFAFormFieldsAsIfPrinted()
The Flattened appearance will take into consideration how the document should appear when printed.
https://www.datalogics.com/pdf-form-functions.
public void flattenNonFormAnnotations()
NOTE: This method is part of the APDFL Forms Extension that is available separately from APDFL. For more information, please see https://www.datalogics.com/pdf-form-functions.
public PDDocFormsType getFormsType()
https://www.datalogics.com/pdf-form-functions.