IDocument
All Implemented Interfaces: com.aspose.ms.System.IDisposable, java.io.Closeable
public interface IDocument extends System.IDisposable, Closeable
interface representing PDF document
Methods
Method | Description |
---|---|
isPdfaCompliant() | |
isPdfUaCompliant() | Gets the is document pdfua compliant. |
getDestinations() | Gets the collection of destinations. |
getPdfFormat() | |
isDisableFontLicenseVerifications() | Many operations with font can’t be executed if these operations are prohibited by license of this font. |
setDisableFontLicenseVerifications(boolean value) | Many operations with font can’t be executed if these operations are prohibited by license of this font. |
removePdfaCompliance() | Remove pdfa compliance from the document |
getCollection() | Gets collection of document. |
setCollection(Collection value) | Sets collection of document. |
getEngineDoc() | Instance of IPdfDocument used to access to internal document structure. |
getVersion() | Gets a version of Pdf from Pdf file header. |
getOpenAction() | Gets action performed at document opening. |
setOpenAction(IAppointment value) | Sets action performed at document opening. |
getOptimizeSize() | Gets optimization flag. |
setOptimizeSize(boolean value) | Sets optimization flag. |
getIgnoreCorruptedObjects() | Gets or sets flag of ignoring errors in source files. |
setIgnoreCorruptedObjects(boolean value) | |
getCatalogValue(String key) | Returns item value from catalog dictionary. |
isHideToolBar() | Gets flag specifying whether toolbar should be hidden when document is active. |
setHideToolBar(boolean value) | Set flag specifying whether toolbar should be hidden when document is active. |
isHideMenubar() | Gets flag specifying whether menu bar should be hidden when document is active. |
setHideMenubar(boolean value) | Sets flag specifying whether menu bar should be hidden when document is active. |
isHideWindowUI() | Gets or sets flag specifying whether user interface elements should be hidden when document is active. |
setHideWindowUI(boolean value) | Sets flag specifying whether user interface elements should be hidden when document is active. |
isFitWindow() | Gets flag specifying whether document window must be resized to fit the first displayed page. |
setFitWindow(boolean value) | Sets flag specifying whether document window must be resized to fit the first displayed page. |
isCenterWindow() | Gets flag specifying whether position of the document’s window will be centerd on the screen. |
setCenterWindow(boolean value) | Sets flag specifying whether position of the document’s window will be centerd on the screen. |
isDisplayDocTitle() | Gets flag specifying whether document’s window title bar should display document title. |
setDisplayDocTitle(boolean value) | Sets flag specifying whether document’s window title bar should display document title. |
getPages() | Gets collection of document pages. |
getOutlines() | Gets document outlines. |
getActions() | Gets document actions. |
getForm() | Gets Acro Form of the document. |
getEmbeddedFiles() | Gets collection of files embedded to document. |
getDirection() | Gets reading order of text: L2R (left to right) or R2L (right to left). |
setDirection(int value) | Sets reading order of text: L2R (left to right) or R2L (right to left). |
getPageMode() | Gets page mode, specifying how document should be displayed when opened. |
setPageMode(int value) | Sets page mode, specifying how document should be displayed when opened. |
getNonFullScreenPageMode() | Gets page mode, specifying how to display the document on exiting full-screen mode. |
setNonFullScreenPageMode(int value) | Sets page mode, specifying how to display the document on exiting full-screen mode. |
getPageLayout() | Gets page layout which shall be used when the document is opened. |
setPageLayout(int value) | Sets page layout which shall be used when the document is opened. |
getDuplex() | Gets or sets print duplex mode handling option to use when printing the file from the print dialog. |
setDuplex(int value) | Gets or sets print duplex mode handling option to use when printing the file from the print dialog. |
getFileName() | Name of the PDF file that caused this document |
setLayersAdded(boolean value) | Set LayersAdded value |
getPageInfo() | Gets the page info. |
setPageInfo(PageInfo value) | Sets the page info. |
getEnableSignatureSanitization() | Gets or sets flag to manage signature fields sanitization. |
setEnableSignatureSanitization(boolean value) | Gets or sets flag to manage signature fields sanitization. |
getInfo() | Gets document info. |
getMetadata() | Document metadata. |
getLogicalStructure() | Gets logical structure of the document. |
processParagraphs() | Stores document into stream. |
save(OutputStream output) | Stores document into stream. |
saveIncrementally(OutputStream output) | Saves incrementally the PDF Document to the specified stream. |
saveIncrementally(System.IO.Stream output) | Saves incrementally the PDF Document to the specified stream. |
save(String outputFileName) | Saves document into the specified file. |
exportAnnotationsToXfdf(String fileName) | Exports all document annotations to XFDF file |
sendTo(DocumentDevice device, OutputStream output) | Sends the whole document to the document device for processing. |
sendTo(DocumentDevice device, int fromPage, int toPage, OutputStream output) | Sends the certain pages of the document to the document device for processing. |
sendTo(DocumentDevice device, String outputFileName) | Sends the whole document to the document device for processing. |
sendTo(DocumentDevice device, int fromPage, int toPage, String outputFileName) | Sends the whole document to the document device for processing. |
removeMetadata() | Removes metadata from the document. |
importAnnotationsFromXfdf(String fileName) | Imports annotations from XFDF file to document. |
validate(String outputLogFileName, PdfFormat format) | Validate document into the specified file. |
validate(OutputStream outputLogStream, PdfFormat format) | Validate document into the specified file. |
convert(String outputLogFileName, PdfFormat format, int action, int transparencyAction) | Convert document and save errors into the specified file. |
convert(String outputLogFileName, PdfFormat format, int action) | Convert document and save errors into the specified file. |
convert(PdfFormatConversionOptions options) | Convert document using specified conversion options |
convert(Document.CallBackGetHocr callback) | Convert document to searchable document. |
convertWithSkippingErrors(Document.CallBackGetHocr callback) | Convert document to searchable document and skip errors of hochr that can not be converted. |
convert(Document.CallBackGetHocr callback, boolean isTestVisible) | Convert document and save errors into the specified file. |
convert(Document.CallBackGetHocr callback, boolean isTestVisible, boolean isOriginalImage) | Convert document and save errors into the specified file. |
convert(OutputStream outputLogStream, PdfFormat format, int action) | |
flatten() | Removes all fields (and annotations) from the document and place their values instead. |
flatten(Form.FlattenSettings flattenSettings) | Removes all fields from the document and place their values instead. |
getCryptoAlgorithm() | Gets security settings if document is encrypted. |
encrypt(String userPassword, String ownerPassword, DocumentPrivilege privileges, CryptoAlgorithm cryptoAlgorithm, boolean usePdf20) | Encrypts the document. |
encrypt(String userPassword, String ownerPassword, int permissions, CryptoAlgorithm cryptoAlgorithm) | Encrypts the document. |
encrypt(String userPassword, String ownerPassword, int permissions, CryptoAlgorithm cryptoAlgorithm, boolean usePdf20) | Encrypts the document. |
changePasswords(String ownerPassword, String newUserPassword, String newOwnerPassword) | Changes document passwords. |
isLinearized() | Gets or sets a value indicating whether document is linearized. |
setLinearized(boolean value) | Sets a value indicating whether document is linearized. |
decrypt() | Decrypts the document. |
getPermissions() | Gets permissions of the document. |
isEncrypted() | Gets encrypted status of the document. |
optimize() | Linearize document in order to - open the first page as quickly as possible; - display next page or follow by link to the next page as quickly as possible; - display the page incrementally as it arrives when data for a page is delivered over a slow channel (display the most useful data first); - permit user interaction, such as following a link, to be performed even before the entire page has been received and displayed. |
save() | Save document incrementally (i.e. using incremental update technique). |
saveIncrementally(String outputFileName) | Saves incrementally the PDF Document to the specified stream. |
save(OutputStream outputStream, SaveFormat format) | Save document |
save(String outputFileName, SaveOptions options) | Saves the document with a new name setting its save options. |
save(OutputStream outputStream, SaveOptions options) | Saves the document with a new name setting its save options. |
getId() | Gets the ID. |
getMetadataStream() | Returns raw metadata stream |
updatePages() | updatePages |
suppressUpdate() | suppressUpdate |
resumeUpdate() | resumeUpdate |
dispose() | Closes all resources used by this document. |
close() | Closes all resources used by this document. |
getBackground() | Gets the background color of the document. |
setBackground(Color value) | Sets the background color of the document. |
getDefaultCopier() | Returns copier used for coping pages to this document. |
optimizeResources() | Optimize resources in the document: 1. |
optimizeResources(OptimizationOptions strategy) | Optimize resources in the document according to defined optimization strategy. |
getPageLabels() | Gets page labels in the document. |
freeMemory() | Clears memory |
afterImport() | Enumerate all registered annotations and call AfterImport for each of them. |
saveXml(String file) | Save document to XML. |
bindXml(String xmlFile, String xslFile) | Bind xml/xsl to document |
getObjectById(String id) | Gets a object with specified ID in the document. |
bindXml(InputStream stream) | Bind xml to document |
bindXml(String file) | Bind xml to document |
repair() | Repairs broken document. |
getEmbedStandardFonts() | Property which declares that document must embed all standard Type1 fonts which has flag IsEmbedded set into true. |
setEmbedStandardFonts(boolean value) | Property which declares that document must embed all standard Type1 fonts which has flag IsEmbedded set into true. |
convertInternal(System.IO.Stream log, PdfFormat _convertTo, int none) | Internal method |
getXmpMetadata(OutputStream stream) | Get XMP metadata from document. |
setXmpMetadata(InputStream stream) | Set XMP metadata of document. |
isAbsentFontTryToSubstitute() | Notification about missing fonts when processing documents |
setAbsentFontTryToSubstitute(boolean setAbsentFontTryToSubstitute) | Setting flag for set program determined font in case of absence font. |
isXrefGapsAllowed() | Gets or sets the is document pdfa compliant. |
setXrefGapsAllowed(boolean value) | Gets or sets the is document pdfa compliant. |
getNamedDestinations() | Collection of Named Destination in the document. |
check(boolean doRepair) | Validates document. |
removePdfUaCompliance() | Remove pdfUa compliance from the document |
setConvertMetadataAndCatalogOnly(boolean value) | Gets convert parameter for pdf/ua converter (Convert only Metadata and Document Catalog if set true) |
setTitle(String title) | Set Title for Pdf Document |
isManualDisposeEnabled() | By default method save close internal streams and release memory resources. |
setManualDisposeEnabled(boolean manualDisposeEnabled) | By default method save closes internal streams and release memory resources. |
pageNodesToBalancedTree() | Organizes page tree nodes in a document into a balanced tree. |
pageNodesToBalancedTree(byte nodesNumInSubtrees) | Organizes page tree nodes in a document into a balanced tree. |
isPdfaCompliant()
public abstract boolean isPdfaCompliant()
Returns: boolean
isPdfUaCompliant()
public abstract boolean isPdfUaCompliant()
Gets the is document pdfua compliant.
Returns: boolean - boolean value
getDestinations()
public abstract DestinationCollection getDestinations()
Gets the collection of destinations.
Returns: DestinationCollection - DestinationCollection object
getPdfFormat()
public abstract PdfFormat getPdfFormat()
Returns: PdfFormat - PdfFormat element
isDisableFontLicenseVerifications()
public abstract boolean isDisableFontLicenseVerifications()
Many operations with font can’t be executed if these operations are prohibited by license of this font. For example some font can’t be embedded into PDF document if license rules disable embedding for this font. This flag is used to disable any license restrictions for all fonts in current PDF document. Be careful when using this flag. When it is set it means that person who sets this flag, takes all responsibility of possible license/law violations on himself. So He takes it on it’s own risk. It’s strongly recommended to use this flag only when you are fully confident that you are not breaking the copyright law.
Returns: boolean - boolean value By default false.
setDisableFontLicenseVerifications(boolean value)
public abstract void setDisableFontLicenseVerifications(boolean value)
Many operations with font can’t be executed if these operations are prohibited by license of this font. For example some font can’t be embedded into PDF document if license rules disable embedding for this font. This flag is used to disable any license restrictions for all fonts in current PDF document. Be careful when using this flag. When it is set it means that person who sets this flag, takes all responsibility of possible license/law violations on himself. So He takes it on it’s own risk. It’s strongly recommended to use this flag only when you are fully confident that you are not breaking the copyright law.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value By default false. |
removePdfaCompliance()
public abstract void removePdfaCompliance()
Remove pdfa compliance from the document
getCollection()
public abstract Collection getCollection()
Gets collection of document.
Returns: Collection - Collection object
setCollection(Collection value)
public abstract void setCollection(Collection value)
Sets collection of document.
Parameters:
Parameter | Type | Description |
---|---|---|
value | Collection | Collection object |
getEngineDoc()
public abstract IPdfDocument getEngineDoc()
Instance of IPdfDocument used to access to internal document structure. Internal only
Returns: IPdfDocument - IPdfDocument object
getVersion()
public abstract String getVersion()
Gets a version of Pdf from Pdf file header.
Returns: java.lang.String - String object
getOpenAction()
public abstract IAppointment getOpenAction()
Gets action performed at document opening.
Example demonstrates how to get CenterWindow flag:
Document document = new Document("sample.pdf");
IAppointment value = document.getOpenAction();
Returns: IAppointment - IAppointment object
setOpenAction(IAppointment value)
public abstract void setOpenAction(IAppointment value)
Sets action performed at document opening.
Parameters:
Parameter | Type | Description |
---|---|---|
value | IAppointment | IAppointment object |
getOptimizeSize()
public abstract boolean getOptimizeSize()
Gets optimization flag. When pages are added to document, equal resource streams in resultant file are merged into one PDF object if this flag set. This allows to decrease resultant file size but may cause slower execution and larger memory requirements. Default value: false.
Returns: boolean - boolean value
setOptimizeSize(boolean value)
public abstract void setOptimizeSize(boolean value)
Sets optimization flag. When pages are added to document, equal resource streams in resultant file are merged into one PDF object if this flag set. This allows to decrease resultant file size but may cause slower execution and larger memory requirements. Default value: false.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
getIgnoreCorruptedObjects()
public abstract boolean getIgnoreCorruptedObjects()
Gets or sets flag of ignoring errors in source files. When pages from source document copied into destination document, copying process is stopped with exception if some objects in source files are corrupted when this flag is false. example: dest.Pages.Add(src.Pages); If this flag is set to true then corrupted objects will be replaced with empty values. By default: true.
Returns: boolean - boolean value
setIgnoreCorruptedObjects(boolean value)
public abstract void setIgnoreCorruptedObjects(boolean value)
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean |
getCatalogValue(String key)
public abstract Object getCatalogValue(String key)
Returns item value from catalog dictionary.
Parameters:
Parameter | Type | Description |
---|---|---|
key | java.lang.String | The key of item. |
Returns: java.lang.Object - Item value - if key was successfully found; otherwise, null.
isHideToolBar()
public abstract boolean isHideToolBar()
Gets flag specifying whether toolbar should be hidden when document is active.
Example demonstrates how to get HideToolBar flag:
Document document = new Document("sample.pdf");
boolean value = document.isHideToolBar();
Returns: boolean - boolean value
setHideToolBar(boolean value)
public abstract void setHideToolBar(boolean value)
Set flag specifying whether toolbar should be hidden when document is active.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
isHideMenubar()
public abstract boolean isHideMenubar()
Gets flag specifying whether menu bar should be hidden when document is active.
Example demonstrates how to get HideMenubar flag:
Document document = new Document("sample.pdf");
boolean value = document.isHideMenubar();
Returns: boolean - boolean value
setHideMenubar(boolean value)
public abstract void setHideMenubar(boolean value)
Sets flag specifying whether menu bar should be hidden when document is active.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
isHideWindowUI()
public abstract boolean isHideWindowUI()
Gets or sets flag specifying whether user interface elements should be hidden when document is active.
Example demonstrates how to get HideWindowUI flag:
Document document = new Document("sample.pdf");
boolean value = document.isHideWindowUI();
Returns: boolean - boolean value
setHideWindowUI(boolean value)
public abstract void setHideWindowUI(boolean value)
Sets flag specifying whether user interface elements should be hidden when document is active.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
isFitWindow()
public abstract boolean isFitWindow()
Gets flag specifying whether document window must be resized to fit the first displayed page.
Example demonstrates how to get FitWindow flag:
Document document = new Document("sample.pdf");
boolean value = document.isFitWindow();
Returns: boolean - boolean value
setFitWindow(boolean value)
public abstract void setFitWindow(boolean value)
Sets flag specifying whether document window must be resized to fit the first displayed page.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
isCenterWindow()
public abstract boolean isCenterWindow()
Gets flag specifying whether position of the document’s window will be centerd on the screen.
Example demonstrates how to get CenterWindow flag:
Document document = new Document("sample.pdf");
boolean value = document.isCenterWindow();
Returns: boolean - boolean value
setCenterWindow(boolean value)
public abstract void setCenterWindow(boolean value)
Sets flag specifying whether position of the document’s window will be centerd on the screen.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
isDisplayDocTitle()
public abstract boolean isDisplayDocTitle()
Gets flag specifying whether document’s window title bar should display document title.
Example demonstrates how to get DisplayDocTitle flag:
Document document = new Document("sample.pdf");
boolean value = document.isDisplayDocTitle();
Returns: boolean - boolean value
setDisplayDocTitle(boolean value)
public abstract void setDisplayDocTitle(boolean value)
Sets flag specifying whether document’s window title bar should display document title.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
getPages()
public abstract PageCollection getPages()
Gets collection of document pages. Note that pages are numbered from 1 in collection.
Example below demonstrates how to operate with the document pages:
How to obtain number of pages and how to obtain rectangle of starting page of the document.
Document document = new Document("sample.pdf");
Pages pages = document.getPages();
System.out.println("Document contains " + pages.size());
Page page = pages.get_Item(1);
Rectangle rect = page.getRect();
Returns: PageCollection - boolean value
getOutlines()
public abstract OutlineCollection getOutlines()
Gets document outlines.
Returns: OutlineCollection - OutlineCollection object
getActions()
public abstract DocumentActionCollection getActions()
Gets document actions. This property is instance of DocumentActions class which allows to get/set BeforClosing, BeforSaving, etc. actions.
This example demonstrates how to obtain after open action of the document:
Document document = new Document("PdfWithOpenAction.pdf");
DocumentActions actions = document.getActions();
com.aspose.pdf.Action afterSavingAction = actions.getAfterSaving();
Returns: DocumentActionCollection - DocumentActionCollection object
getForm()
public abstract Form getForm()
Gets Acro Form of the document.
Returns: Form - Form object
getEmbeddedFiles()
public abstract EmbeddedFileCollection getEmbeddedFiles()
Gets collection of files embedded to document.
Returns: EmbeddedFileCollection - EmbeddedFileCollection object
getDirection()
public abstract int getDirection()
Gets reading order of text: L2R (left to right) or R2L (right to left).
Returns: int - Direction element
setDirection(int value)
public abstract void setDirection(int value)
Sets reading order of text: L2R (left to right) or R2L (right to left).
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | Direction element |
getPageMode()
public abstract int getPageMode()
Gets page mode, specifying how document should be displayed when opened.
Returns: int - PageMode element
setPageMode(int value)
public abstract void setPageMode(int value)
Sets page mode, specifying how document should be displayed when opened.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | PageMode element |
getNonFullScreenPageMode()
public abstract int getNonFullScreenPageMode()
Gets page mode, specifying how to display the document on exiting full-screen mode.
Returns: int - PageMode element
setNonFullScreenPageMode(int value)
public abstract void setNonFullScreenPageMode(int value)
Sets page mode, specifying how to display the document on exiting full-screen mode.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | PageMode element |
getPageLayout()
public abstract int getPageLayout()
Gets page layout which shall be used when the document is opened.
Returns: int - PageLayout element
setPageLayout(int value)
public abstract void setPageLayout(int value)
Sets page layout which shall be used when the document is opened.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | PageLayout element |
getDuplex()
public abstract int getDuplex()
Gets or sets print duplex mode handling option to use when printing the file from the print dialog.
Returns: int - PrintDuplex element
setDuplex(int value)
public abstract void setDuplex(int value)
Gets or sets print duplex mode handling option to use when printing the file from the print dialog.
Parameters:
Parameter | Type | Description |
---|---|---|
value | int | PrintDuplex element |
getFileName()
public abstract String getFileName()
Name of the PDF file that caused this document
Returns: java.lang.String - String object
setLayersAdded(boolean value)
public abstract void setLayersAdded(boolean value)
Set LayersAdded value
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
getPageInfo()
public abstract PageInfo getPageInfo()
Gets the page info.(for generator only, not filled in when reading document)
Returns: PageInfo - The page info.
setPageInfo(PageInfo value)
public abstract void setPageInfo(PageInfo value)
Sets the page info.(for generator only, not filled in when reading document)
Parameters:
Parameter | Type | Description |
---|---|---|
value | PageInfo | PageInfo object |
getEnableSignatureSanitization()
public abstract boolean getEnableSignatureSanitization()
Gets or sets flag to manage signature fields sanitization. Enabled by default.
Returns: boolean - boolean value
setEnableSignatureSanitization(boolean value)
public abstract void setEnableSignatureSanitization(boolean value)
Gets or sets flag to manage signature fields sanitization. Enabled by default.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
getInfo()
public abstract DocumentInfo getInfo()
Gets document info.
Returns: DocumentInfo - DocumentInfo object
getMetadata()
public abstract Metadata getMetadata()
Document metadata. (A PDF document may include general information, such as the document’s title, author, and creation and modification dates. Such global information about the document (as opposed to its content or structure) is called metadata and is intended to assist in cataloguing and searching for documents in external databases.)
Returns: Metadata - Metadata object
getLogicalStructure()
public abstract RootElement getLogicalStructure()
Gets logical structure of the document.
Returns: RootElement - RootElement object
processParagraphs()
public abstract void processParagraphs()
Stores document into stream.
save(OutputStream output)
public abstract void save(OutputStream output)
Stores document into stream.
Parameters:
Parameter | Type | Description |
---|---|---|
output | java.io.OutputStream | Stream where document shell be stored. |
saveIncrementally(OutputStream output)
public abstract void saveIncrementally(OutputStream output)
Saves incrementally the PDF Document to the specified stream.
Parameters:
Parameter | Type | Description |
---|---|---|
output | java.io.OutputStream | OutputStream object |
saveIncrementally(System.IO.Stream output)
public abstract void saveIncrementally(System.IO.Stream output)
Saves incrementally the PDF Document to the specified stream.
Parameters:
Parameter | Type | Description |
---|---|---|
output | com.aspose.ms.System.IO.Stream | OutputStream object |
save(String outputFileName)
public abstract void save(String outputFileName)
Saves document into the specified file.
Parameters:
Parameter | Type | Description |
---|---|---|
outputFileName | java.lang.String | Path to file where the document will be stored. |
exportAnnotationsToXfdf(String fileName)
public abstract void exportAnnotationsToXfdf(String fileName)
Exports all document annotations to XFDF file
Parameters:
Parameter | Type | Description |
---|---|---|
fileName | java.lang.String | XFDF file name |
sendTo(DocumentDevice device, OutputStream output)
public abstract void sendTo(DocumentDevice device, OutputStream output)
Sends the whole document to the document device for processing.
Parameters:
Parameter | Type | Description |
---|---|---|
device | DocumentDevice | DocumentDevice object |
output | java.io.OutputStream | OutputStream object |
sendTo(DocumentDevice device, int fromPage, int toPage, OutputStream output)
public abstract void sendTo(DocumentDevice device, int fromPage, int toPage, OutputStream output)
Sends the certain pages of the document to the document device for processing.
Parameters:
Parameter | Type | Description |
---|---|---|
device | DocumentDevice | Document device which is used to process the document. |
fromPage | int | The first page for processing. |
toPage | int | The last page for processing. |
output | java.io.OutputStream | Output stream contains the results of the document pages processing with given device. |
sendTo(DocumentDevice device, String outputFileName)
public abstract void sendTo(DocumentDevice device, String outputFileName)
Sends the whole document to the document device for processing.
Parameters:
Parameter | Type | Description |
---|---|---|
device | DocumentDevice | Document device which is used to process the document. |
outputFileName | java.lang.String | Output file name with the results of processing. |
sendTo(DocumentDevice device, int fromPage, int toPage, String outputFileName)
public abstract void sendTo(DocumentDevice device, int fromPage, int toPage, String outputFileName)
Sends the whole document to the document device for processing.
Parameters:
Parameter | Type | Description |
---|---|---|
device | DocumentDevice | Document device which is used to process the document. |
fromPage | int | The first page for processing. |
toPage | int | The last page for processing. |
outputFileName | java.lang.String | Output file name with the results of processing. |
removeMetadata()
public abstract void removeMetadata()
Removes metadata from the document.
importAnnotationsFromXfdf(String fileName)
public abstract void importAnnotationsFromXfdf(String fileName)
Imports annotations from XFDF file to document.
Parameters:
Parameter | Type | Description |
---|---|---|
fileName | java.lang.String | XFDF file name |
validate(String outputLogFileName, PdfFormat format)
public abstract boolean validate(String outputLogFileName, PdfFormat format)
Validate document into the specified file.
Parameters:
Parameter | Type | Description |
---|---|---|
outputLogFileName | java.lang.String | Path to file where the comments will be stored. |
format | PdfFormat | Pdf format. |
Returns: boolean - boolean value
validate(OutputStream outputLogStream, PdfFormat format)
public abstract boolean validate(OutputStream outputLogStream, PdfFormat format)
Validate document into the specified file.
Parameters:
Parameter | Type | Description |
---|---|---|
outputLogStream | java.io.OutputStream | Stream where the comments will be stored. |
format | PdfFormat | Pdf format. |
Returns: boolean - The operation result
convert(String outputLogFileName, PdfFormat format, int action, int transparencyAction)
public abstract boolean convert(String outputLogFileName, PdfFormat format, int action, int transparencyAction)
Convert document and save errors into the specified file.
Parameters:
Parameter | Type | Description |
---|---|---|
outputLogFileName | java.lang.String | Path to file where the comments will be stored. |
format | PdfFormat | The pdf format. |
action | int | Action for objects that can not be converted |
transparencyAction | int | Action for image masked objects |
Returns: boolean - The operation result
convert(String outputLogFileName, PdfFormat format, int action)
public abstract boolean convert(String outputLogFileName, PdfFormat format, int action)
Convert document and save errors into the specified file.
Parameters:
Parameter | Type | Description |
---|---|---|
outputLogFileName | java.lang.String | Path to file where the comments will be stored. |
format | PdfFormat | Pdf format. |
action | int | Action for objects that can not be converted |
Returns: boolean - The operation result
convert(PdfFormatConversionOptions options)
public abstract boolean convert(PdfFormatConversionOptions options)
Convert document using specified conversion options
Parameters:
Parameter | Type | Description |
---|---|---|
options | PdfFormatConversionOptions | set of options for convert PDF document |
Returns: boolean - The operation result
convert(Document.CallBackGetHocr callback)
public abstract boolean convert(Document.CallBackGetHocr callback)
Convert document to searchable document.
Parameters:
Parameter | Type | Description |
---|---|---|
callback | CallBackGetHocr | The call back procedure for hocr recognize. |
Returns: boolean - boolean value
convertWithSkippingErrors(Document.CallBackGetHocr callback)
public abstract boolean convertWithSkippingErrors(Document.CallBackGetHocr callback)
Convert document to searchable document and skip errors of hochr that can not be converted.
Parameters:
Parameter | Type | Description |
---|---|---|
callback | CallBackGetHocr | The call back procedure for hocr recognize. |
Returns: boolean - boolean value
convert(Document.CallBackGetHocr callback, boolean isTestVisible)
public abstract boolean convert(Document.CallBackGetHocr callback, boolean isTestVisible)
Convert document and save errors into the specified file.
This is allow to show/hide searchable text on page. Default value is FALSE.
Parameters:
Parameter | Type | Description |
---|---|---|
callback | CallBackGetHocr | Action for objects that can not be converted |
isTestVisible | boolean | boolean value |
Returns: boolean - The operation result
convert(Document.CallBackGetHocr callback, boolean isTestVisible, boolean isOriginalImage)
public abstract boolean convert(Document.CallBackGetHocr callback, boolean isTestVisible, boolean isOriginalImage)
Convert document and save errors into the specified file.
This is allow to show/hide searchable text on page. Default value is FALSE. This is allow to getting original image from pdf. Default value is FALSE.
Parameters:
Parameter | Type | Description |
---|---|---|
callback | CallBackGetHocr | Action for objects that can not be converted |
isTestVisible | boolean | boolean value |
isOriginalImage | boolean | boolean value |
Returns: boolean - The operation result
convert(OutputStream outputLogStream, PdfFormat format, int action)
public abstract boolean convert(OutputStream outputLogStream, PdfFormat format, int action)
Parameters:
Parameter | Type | Description |
---|---|---|
outputLogStream | java.io.OutputStream | |
format | PdfFormat | |
action | int |
Returns: boolean
flatten()
public abstract void flatten()
Removes all fields (and annotations) from the document and place their values instead.
flatten(Form.FlattenSettings flattenSettings)
public abstract void flatten(Form.FlattenSettings flattenSettings)
Removes all fields from the document and place their values instead.
Parameters:
Parameter | Type | Description |
---|---|---|
flattenSettings | FlattenSettings | Settings for flattening process. |
getCryptoAlgorithm()
public abstract CryptoAlgorithm getCryptoAlgorithm()
Gets security settings if document is encrypted. If document is not encrypted then will be null
Returns: CryptoAlgorithm - CryptoAlgorithm element or null
encrypt(String userPassword, String ownerPassword, DocumentPrivilege privileges, CryptoAlgorithm cryptoAlgorithm, boolean usePdf20)
public abstract void encrypt(String userPassword, String ownerPassword, DocumentPrivilege privileges, CryptoAlgorithm cryptoAlgorithm, boolean usePdf20)
Encrypts the document. Call then Save to get encrypted version of the document.
Parameters:
Parameter | Type | Description |
---|---|---|
userPassword | java.lang.String | User password. |
ownerPassword | java.lang.String | Owner password. |
privileges | DocumentPrivilege | Document permissions, see Permissions for details. |
cryptoAlgorithm | CryptoAlgorithm | Cryptographic algorithm, see CryptoAlgorithm for details. |
usePdf20 | boolean | Support for revision 6 (Extension 8). |
encrypt(String userPassword, String ownerPassword, int permissions, CryptoAlgorithm cryptoAlgorithm)
public abstract void encrypt(String userPassword, String ownerPassword, int permissions, CryptoAlgorithm cryptoAlgorithm)
Encrypts the document. Call then Save to get encrypted version of the document.
Parameters:
Parameter | Type | Description |
---|---|---|
userPassword | java.lang.String | User password. |
ownerPassword | java.lang.String | Owner password. |
permissions | int | Document permissions, see Permissions for details. |
cryptoAlgorithm | CryptoAlgorithm | Cryptographic algorithm, see CryptoAlgorithm for details. |
encrypt(String userPassword, String ownerPassword, int permissions, CryptoAlgorithm cryptoAlgorithm, boolean usePdf20)
public abstract void encrypt(String userPassword, String ownerPassword, int permissions, CryptoAlgorithm cryptoAlgorithm, boolean usePdf20)
Encrypts the document. Call then Save to get encrypted version of the document.
Parameters:
Parameter | Type | Description |
---|---|---|
userPassword | java.lang.String | User password. |
ownerPassword | java.lang.String | Owner password. |
permissions | int | Document permissions, see Permissions for details. |
cryptoAlgorithm | CryptoAlgorithm | Cryptographic algorithm, see CryptoAlgorithm for details. |
usePdf20 | boolean | Support for revision 6 (Extension 8). |
changePasswords(String ownerPassword, String newUserPassword, String newOwnerPassword)
public abstract void changePasswords(String ownerPassword, String newUserPassword, String newOwnerPassword)
Changes document passwords. This action can be done only using owner password.
Parameters:
Parameter | Type | Description |
---|---|---|
ownerPassword | java.lang.String | Owner password. |
newUserPassword | java.lang.String | New user password. |
newOwnerPassword | java.lang.String | New owner password. |
isLinearized()
public abstract boolean isLinearized()
Gets or sets a value indicating whether document is linearized.
Returns: boolean - boolean value
setLinearized(boolean value)
public abstract void setLinearized(boolean value)
Sets a value indicating whether document is linearized.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
decrypt()
public abstract void decrypt()
Decrypts the document. Call then Save to obtain decrypted version of the document.
getPermissions()
public abstract int getPermissions()
Gets permissions of the document.
Returns: int - int value
isEncrypted()
public abstract boolean isEncrypted()
Gets encrypted status of the document. True if document is encrypted.
Returns: boolean - boolean value
optimize()
public abstract void optimize()
Linearize document in order to - open the first page as quickly as possible; - display next page or follow by link to the next page as quickly as possible; - display the page incrementally as it arrives when data for a page is delivered over a slow channel (display the most useful data first); - permit user interaction, such as following a link, to be performed even before the entire page has been received and displayed. Invoking this method doesn’t actually saves the document. On the contrary the document only is prepared to have optimized structure, call then Save to get optimized document.
save()
public abstract void save()
Save document incrementally (i.e. using incremental update technique).
In order to save document incrementally we should open the document file for writing. Therefore Document must not be initialized with InputStream but with path to the file, like in the next code snippet: Document doc = new Document(“document.pdf”); // make some changes and save the document incrementally doc.save();
In case when document was initialized with InputStream, writing to InputStream is impossible, so we recommend to use separate methods “save” to save document or “saveIncrementally” to save document incrementally.
saveIncrementally(String outputFileName)
public abstract void saveIncrementally(String outputFileName)
Saves incrementally the PDF Document to the specified stream.
Parameters:
Parameter | Type | Description |
---|---|---|
outputFileName | java.lang.String | String value |
save(OutputStream outputStream, SaveFormat format)
public abstract void save(OutputStream outputStream, SaveFormat format)
Save document
Parameters:
Parameter | Type | Description |
---|---|---|
outputStream | java.io.OutputStream | OutputStream object |
format | SaveFormat | SaveFormat value |
save(String outputFileName, SaveOptions options)
public abstract void save(String outputFileName, SaveOptions options)
Saves the document with a new name setting its save options.
Parameters:
Parameter | Type | Description |
---|---|---|
outputFileName | java.lang.String | Path to file where the document will be stored. |
options | SaveOptions | Save options. |
save(OutputStream outputStream, SaveOptions options)
public abstract void save(OutputStream outputStream, SaveOptions options)
Saves the document with a new name setting its save options.
Parameters:
Parameter | Type | Description |
---|---|---|
outputStream | java.io.OutputStream | OutputStream where the document will be stored. |
options | SaveOptions | Save options. |
getId()
public abstract Id getId()
Gets the ID.
Returns: Id - Id object
getMetadataStream()
public abstract IPdfStreamAccessor getMetadataStream()
Returns raw metadata stream
Returns: IPdfStreamAccessor - IPdfStreamAccessor object
updatePages()
public abstract void updatePages()
updatePages
suppressUpdate()
public abstract void suppressUpdate()
suppressUpdate
resumeUpdate()
public abstract void resumeUpdate()
resumeUpdate
dispose()
public abstract void dispose()
Closes all resources used by this document.
This method is obsoleted, use close() instead.
close()
public abstract void close()
Closes all resources used by this document.
getBackground()
public abstract Color getBackground()
Gets the background color of the document.
Returns: Color - java.awt.Color object
setBackground(Color value)
public abstract void setBackground(Color value)
Sets the background color of the document.
Parameters:
Parameter | Type | Description |
---|---|---|
value | java.awt.Color | java.awt.Color object |
getDefaultCopier()
public abstract Copier getDefaultCopier()
Returns copier used for coping pages to this document.
Returns: Copier - Copier object
optimizeResources()
public abstract void optimizeResources()
Optimize resources in the document: 1. Resources which are not used on the document pages are removed; 2. Equal resources are joined into one object; 3. Unused objects are deleted.
optimizeResources(OptimizationOptions strategy)
public abstract void optimizeResources(OptimizationOptions strategy)
Optimize resources in the document according to defined optimization strategy.
Parameters:
Parameter | Type | Description |
---|---|---|
strategy | OptimizationOptions | Optimization strategy. |
getPageLabels()
public abstract PageLabelCollection getPageLabels()
Gets page labels in the document.
Returns: PageLabelCollection - PageLabelCollection object
freeMemory()
public abstract void freeMemory()
Clears memory
afterImport()
public abstract void afterImport()
Enumerate all registered annotations and call AfterImport for each of them.
saveXml(String file)
public abstract void saveXml(String file)
Save document to XML.
Parameters:
Parameter | Type | Description |
---|---|---|
file | java.lang.String | The document model xml file |
bindXml(String xmlFile, String xslFile)
public abstract void bindXml(String xmlFile, String xslFile)
Bind xml/xsl to document
Parameters:
Parameter | Type | Description |
---|---|---|
xmlFile | java.lang.String | The xml file. |
xslFile | java.lang.String | The xsl file if XSLT is used. |
getObjectById(String id)
public abstract Object getObjectById(String id)
Gets a object with specified ID in the document.
Parameters:
Parameter | Type | Description |
---|---|---|
id | java.lang.String | The object id. |
Returns: java.lang.Object - The object with specified id. Null if the id is not found.
bindXml(InputStream stream)
public abstract void bindXml(InputStream stream)
Bind xml to document
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | The stream with xml file |
bindXml(String file)
public abstract void bindXml(String file)
Bind xml to document
Parameters:
Parameter | Type | Description |
---|---|---|
file | java.lang.String | The xml file |
repair()
public abstract void repair()
Repairs broken document.
getEmbedStandardFonts()
public abstract boolean getEmbedStandardFonts()
Property which declares that document must embed all standard Type1 fonts which has flag IsEmbedded set into true. All PDF fonts can be embedded into document simply via setting of flag IsEmbedded into true, but PDF standard Type1 fonts is an exception from this rule. Standard Type1 font embedding requires much time, so to embed these fonts it’s necessary not only set flag IsEmbedded into true for specified font but also set an additiona flag on document’s level - EmbedStandardFonts = true; This property can be set only one time for all fonts. By default false.
Returns: boolean - boolean value
setEmbedStandardFonts(boolean value)
public abstract void setEmbedStandardFonts(boolean value)
Property which declares that document must embed all standard Type1 fonts which has flag IsEmbedded set into true. All PDF fonts can be embedded into document simply via setting of flag IsEmbedded into true, but PDF standard Type1 fonts is an exception from this rule. Standard Type1 font embedding requires much time, so to embed these fonts it’s necessary not only set flag IsEmbedded into true for specified font but also set an additiona flag on document’s level - EmbedStandardFonts = true; This property can be set only one time for all fonts. By default false.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
convertInternal(System.IO.Stream log, PdfFormat _convertTo, int none)
public abstract boolean convertInternal(System.IO.Stream log, PdfFormat _convertTo, int none)
Internal method
Parameters:
Parameter | Type | Description |
---|---|---|
log | com.aspose.ms.System.IO.Stream | Internal object |
_convertTo | PdfFormat | Internal object |
none | int | Internal object |
Returns: boolean - Internal value
getXmpMetadata(OutputStream stream)
public abstract void getXmpMetadata(OutputStream stream)
Get XMP metadata from document.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.OutputStream | Stream where metadata will be stored. |
setXmpMetadata(InputStream stream)
public abstract void setXmpMetadata(InputStream stream)
Set XMP metadata of document.
Parameters:
Parameter | Type | Description |
---|---|---|
stream | java.io.InputStream | Stream which contains XMP metadata. |
isAbsentFontTryToSubstitute()
public abstract boolean isAbsentFontTryToSubstitute()
Notification about missing fonts when processing documents
Returns: boolean - boolean value
setAbsentFontTryToSubstitute(boolean setAbsentFontTryToSubstitute)
public abstract void setAbsentFontTryToSubstitute(boolean setAbsentFontTryToSubstitute)
Setting flag for set program determined font in case of absence font.
Parameters:
Parameter | Type | Description |
---|---|---|
setAbsentFontTryToSubstitute | boolean | boolean value |
isXrefGapsAllowed()
public abstract boolean isXrefGapsAllowed()
Gets or sets the is document pdfa compliant.
Returns: boolean - boolean value
setXrefGapsAllowed(boolean value)
public abstract void setXrefGapsAllowed(boolean value)
Gets or sets the is document pdfa compliant.
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
getNamedDestinations()
public abstract NamedDestinationCollection getNamedDestinations()
Collection of Named Destination in the document.
Returns: NamedDestinationCollection - NamedDestinationCollection instance
check(boolean doRepair)
public abstract boolean check(boolean doRepair)
Validates document.
Parameters:
Parameter | Type | Description |
---|---|---|
doRepair | boolean | If true found issues will be repaired. |
Returns: boolean - boolean value
removePdfUaCompliance()
public abstract void removePdfUaCompliance()
Remove pdfUa compliance from the document
setConvertMetadataAndCatalogOnly(boolean value)
public abstract void setConvertMetadataAndCatalogOnly(boolean value)
Gets convert parameter for pdf/ua converter (Convert only Metadata and Document Catalog if set true)
Parameters:
Parameter | Type | Description |
---|---|---|
value | boolean | boolean value |
setTitle(String title)
public abstract void setTitle(String title)
Set Title for Pdf Document
Parameters:
Parameter | Type | Description |
---|---|---|
title | java.lang.String | Document’s title |
isManualDisposeEnabled()
public abstract boolean isManualDisposeEnabled()
By default method save close internal streams and release memory resources. We can do some operations and continue work with the document after method save if this ManualDispose parameter is enabled.
Returns: boolean - boolean value. (Default value == false)
setManualDisposeEnabled(boolean manualDisposeEnabled)
public abstract void setManualDisposeEnabled(boolean manualDisposeEnabled)
By default method save closes internal streams and release memory resources. We can do some operations and continue work with the document after method save is called if this ManualDispose parameter is enabled. But it is strongly recommended to call the dispose method when the Document instance is no longer needed.
Parameters:
Parameter | Type | Description |
---|---|---|
manualDisposeEnabled | boolean | boolean value. (Default value == false) |
pageNodesToBalancedTree()
public abstract void pageNodesToBalancedTree()
Organizes page tree nodes in a document into a balanced tree. Only if the document has more than nodesNumInSubtrees page objects, otherwise it does nothing.
pageNodesToBalancedTree(byte nodesNumInSubtrees)
public abstract void pageNodesToBalancedTree(byte nodesNumInSubtrees)
Organizes page tree nodes in a document into a balanced tree. Only if the document has more than nodesNumInSubtrees page objects, otherwise it does nothing.
Parameters:
Parameter | Type | Description |
---|---|---|
nodesNumInSubtrees | byte | Desired number of subnodes. |