public final class DocumentWeb extends Object implements IDocument
| Modifier and Type | Class and Description |
|---|---|
static class |
com.aspose.pdf.ADocument.AbsentFontHandler
Represents class with abstract method that supplied by information about missing fonts when
processing documents.
|
static class |
com.aspose.pdf.ADocument.FontSubstitutionHandler
It represents class with abstract method that usually supplied by information about missing
font while processing documents.
|
static class |
com.aspose.pdf.ADocument.MergeOptions
Represents the options to Merge methods.
|
static interface |
com.aspose.pdf.ADocument.ProcessParagraphsAction
n optional action to be invoked during the page generation
|
| Modifier and Type | Field and Description |
|---|---|
static byte |
DefaultNodesNumInSubtrees |
PdfEvent<com.aspose.pdf.ADocument.FontSubstitutionHandler> |
FontSubstitution
It occurs when font replaces another font in document.
|
| Constructor and Description |
|---|
DocumentWeb()
Initializes empty DocumentWeb.
|
DocumentWeb(InputStream input)
Initialize new DocumentWeb instance from the
input stream. |
DocumentWeb(InputStream input,
LoadOptions options)
Opens an existing DocumentWeb from a stream providing necessary converting to get pdf
DocumentWeb.
|
DocumentWeb(InputStream input,
String password) |
DocumentWeb(String filename)
Just init DocumentWeb using
filename. |
DocumentWeb(String filename,
LoadOptions options) |
DocumentWeb(String filename,
String password)
Initializes new instance of the
DocumentWeb class for working with encrypted
DocumentWeb. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterImport()
Enumerate all registered annotations and call AfterImport for each of them.
|
void |
bindXml(InputStream stream)
Bind xml to document
|
void |
bindXml(InputStream xmlStream,
InputStream xslStream)
Bind xml/xsl to document
|
void |
bindXml(InputStream xmlStream,
InputStream xslStream,
com.aspose.ms.System.Xml.XmlReaderSettings settings)
Bind xml/xsl to document
|
void |
bindXml(String file)
Bind xml to document
|
void |
bindXml(String xmlFile,
String xslFile)
Bind xml/xsl to document
|
void |
changePasswords(String ownerPassword,
String newUserPassword,
String newOwnerPassword)
Changes document passwords.
|
boolean |
check(boolean doRepair)
Validates document.
|
void |
close()
Closes all resources used by this document.
|
boolean |
convert(Document.CallBackGetHocrBase callback)
Convert document to searchable document.
|
boolean |
convert(Document.CallBackGetHocrBase callback,
boolean flattenImages)
Convert document and save errors into the specified file.
|
boolean |
convert(Document.CallBackGetHocrBase callback,
boolean isTextVisible,
boolean flattenImages)
Convert document and save errors into the specified file.
|
boolean |
convert(Document.CallBackGetHocrBase callback,
boolean isTextVisible,
boolean flattenImages,
boolean isOriginalImage)
Convert document and save errors into the specified file.
|
boolean |
convert(Document.CallBackGetHocr callback,
boolean isTextVisible,
boolean flattenImages,
boolean isOriginalImage,
boolean skipErrorsInRecognitionHOCR)
Convert document and save errors into the specified file.
|
boolean |
convert(Document.CallBackGetHocrWithPage callback,
boolean isTextVisible,
boolean flattenImages,
boolean isOriginalImage,
boolean skipErrorsInRecognitionHOCR)
Convert document and save errors into the specified file.
|
boolean |
convert(Fixup fixup,
OutputStream outputLog)
Convert document by applying the Fixup.
|
boolean |
convert(Fixup fixup,
OutputStream outputLog,
boolean onlyValidation,
Object[] parameters)
Convert document by applying the Fixup.
|
boolean |
convert(Fixup fixup,
String outputLog)
Convert document by applying the Fixup.
|
boolean |
convert(Fixup fixup,
String outputLog,
boolean onlyValidation,
Object[] parameters)
Convert document by applying the Fixup.
|
static void |
convert(InputStream srcStream,
LoadOptions loadOptions,
OutputStream dstStream,
SaveOptions saveOptions)
Converts stream in source format into stream in destination format.
|
static void |
convert(InputStream srcStream,
LoadOptions loadOptions,
String dstFileName,
SaveOptions saveOptions)
Converts stream in source format into destination file in destination format.
|
boolean |
convert(OutputStream outputLogStream,
PdfFormat format,
ConvertErrorAction action)
Convert document and save errors into the specified stream.
|
boolean |
convert(OutputStream outputLogStream,
PdfFormat format,
ConvertErrorAction action,
ConvertTransparencyAction transparencyAction)
Convert document and save errors into the specified file.
|
boolean |
convert(PdfFormatConversionOptions options)
Convert document using specified conversion options
|
static void |
convert(String srcFileName,
LoadOptions loadOptions,
OutputStream dstStream,
SaveOptions saveOptions)
Converts source file in source format into stream in destination format.
|
static void |
convert(String srcFileName,
LoadOptions loadOptions,
String dstFileName,
SaveOptions saveOptions)
Converts source file in source format into destination file in destination format.
|
boolean |
convert(String outputLogFileName,
PdfFormat format,
ConvertErrorAction action)
Convert document and save errors into the specified file.
|
boolean |
convert(String outputLogFileName,
PdfFormat format,
ConvertErrorAction action,
ConvertTransparencyAction transparencyAction)
Convert document and save errors into the specified file.
|
boolean |
convertInternal(com.aspose.ms.System.IO.Stream outputLogStream,
PdfFormat format,
ConvertErrorAction action)
Convert document and save errors into the specified stream.
|
byte[] |
convertPageToPNGMemoryStream(Page page)
Convert page to PNG for DSR, OMR, OCR image stream.
|
boolean |
convertWithFlatten(Document.CallBackGetHocrBase callback)
Convert document to searchable document and skip errors of hochr that can not be converted.
|
boolean |
convertWithSkippingErrors(Document.CallBackGetHocrBase callback)
Convert document to searchable document and skip errors of hochr that can not be converted.
|
void |
decrypt()
Decrypts the document.
|
void |
dispose()
Deprecated.
|
void |
encrypt(int permissions,
CryptoAlgorithm cryptoAlgorithm,
com.aspose.ms.System.Collections.Generic.IGenericList<com.aspose.ms.System.Security.Cryptography.X509Certificates.X509Certificate2> publicCertificates)
Encrypts the document.
|
void |
encrypt(String userPassword,
String ownerPassword,
DocumentPrivilege privileges,
CryptoAlgorithm cryptoAlgorithm,
boolean usePdf20)
Encrypts the document.
|
void |
encrypt(String userPassword,
String ownerPassword,
DocumentPrivilege privileges,
com.aspose.pdf.engine.security.impl.handlers.ICustomSecurityHandler customHandler)
Encrypts the document.
|
void |
encrypt(String userPassword,
String ownerPassword,
int permissions,
CryptoAlgorithm cryptoAlgorithm)
Encrypts the document.
|
void |
encrypt(String userPassword,
String ownerPassword,
int permissions,
CryptoAlgorithm cryptoAlgorithm,
boolean usePdf20)
Encrypts the document.
|
void |
encrypt(String userPassword,
String ownerPassword,
int permissions,
com.aspose.pdf.engine.security.impl.handlers.ICustomSecurityHandler customHandler)
Encrypts the document.
|
void |
exportAnnotationsToXfdf(OutputStream output)
Export all document annotations into stream.
|
void |
exportAnnotationsToXfdf(String fileName)
Exports all document annotations to XFDF file
|
void |
flatten()
Removes all fields (and annotations) from the document and place their values instead.
|
void |
flatten(Form.FlattenSettings flattenSettings)
Removes all fields from the document and place their values instead.
|
void |
flattenTransparency()
Replaces transparent content with non-transparent raster and vector graphics.
|
void |
freeMemory()
Clears memory
|
com.aspose.pdf.ADocument.AbsentFontHandler |
getAbsentFontHandler()
Notification about missing fonts while processing documents.
|
DocumentActionCollection |
getActions()
Gets document actions.
|
boolean |
getAllowReusePageContent()
Allows to merge page contents to optimize docuement size.
|
Color |
getBackground()
Gets the background color of the document.
|
Object |
getCatalogValue(String key)
Returns item value from catalog dictionary.
|
Collection |
getCollection()
Gets collection of document.
|
CryptoAlgorithm |
getCryptoAlgorithm()
Gets security settings if document is encrypted.
|
com.aspose.pdf.engine.security.impl.handlers.ICustomSecurityHandler |
getCustomSecurityHandler()
Gets a custom security handler.
|
Copier |
getDefaultCopier()
Returns copier used for coping pages to this document.
|
DestinationCollection |
getDestinations()
Deprecated.
|
Direction |
getDirection()
Gets reading order of text: L2R (left to right) or R2L (right to left).
|
int |
getDuplex()
Gets or sets print duplex mode handling option to use when printing the file from the print dialog.
|
EmbeddedFileCollection |
getEmbeddedFiles()
Gets collection of files embedded to document.
|
boolean |
getEmbedStandardFonts()
Property which declares that document must embed all standard Type1 fonts which has flag
IsEmbedded set into true.
|
boolean |
getEnableSignatureSanitization()
Gets or sets flag to manage signature fields sanitization.
|
com.aspose.pdf.engine.IPdfDocument |
getEngineDoc()
Instance of IPdfDocument used to access to internal document structure.
|
String |
getFileName()
Name of the PDF file that caused this document
|
static int |
getFileSizeLimitToMemoryLoading()
Get and set the file size limit for loading an entire file into memory.
|
Form |
getForm()
Gets Acro Form of the document.
|
Id |
getId()
Gets the ID.
|
boolean |
getIgnoreCorruptedObjects()
Gets or sets flag of ignoring errors in source files.
|
DocumentInfo |
getInfo()
Gets document info.
|
JavaScriptCollection |
getJavaScript()
Collection of JavaScript of document level.
|
RootElement |
getLogicalStructure()
Gets logical structure of the document.
|
Metadata |
getMetadata()
Document metadata.
|
com.aspose.pdf.engine.data.types.IPdfStreamAccessor |
getMetadataStream()
For internal usage only!
|
NamedDestinationCollection |
getNamedDestinations()
Collection of Named Destination in the document.
|
PageMode |
getNonFullScreenPageMode()
Gets page mode, specifying how to display the document on exiting full-screen mode.
|
Object |
getObjectById(String id)
Gets a object with specified ID in the document.
|
IAppointment |
getOpenAction()
Gets action performed at document opening.
|
boolean |
getOptimizeSize()
Gets optimization flag.
|
OutlineCollection |
getOutlines()
Gets document outlines.
|
OutputIntents |
getOutputIntents()
Gets the collection of Output intents in the document.
|
PageInfo |
getPageInfo()
Gets the page info.(for generator only, not filled in when reading document)
|
PageLabelCollection |
getPageLabels()
Gets page labels in the document.
|
PageLayout |
getPageLayout()
Gets page layout which shall be used when the document is opened.
|
PageMode |
getPageMode()
Gets page mode, specifying how document should be displayed when opened.
|
PageCollection |
getPages()
Gets collection of document pages.
|
PdfFormat |
getPdfFormat()
Gets PDF format.
|
int |
getPermissions()
Gets permissions of the document.
|
int |
getPrintScaling()
Gets print scaling handling option to use when printing the file from the print dialog.
|
ITaggedContent |
getTaggedContent()
Gets access to TaggedPdf content.
|
String |
getVersion()
Gets a version of Pdf from Pdf file header.
|
void |
getXmpMetadata(OutputStream output)
Get XMP metadata from document.
|
boolean |
hasIncrementalUpdate()
Checks if the current PDF document has been saved with incremental updates.
|
void |
importAnnotationsFromXfdf(InputStream stream)
Imports annotations from stream to document.
|
void |
importAnnotationsFromXfdf(String fileName)
Imports annotations from XFDF file to document.
|
boolean |
isAbsentFontTryToSubstitute()
Flag which informs about replacement of missing font.
|
boolean |
isCenterWindow()
Gets flag specifying whether position of the document's window will be centered on the
screen.
|
boolean |
isDisableFontLicenseVerifications()
Many operations with font can't be executed if these operations are prohibited by license of this font.
|
boolean |
isDisplayDocTitle()
Gets flag specifying whether document's window title bar should display document title.
|
boolean |
isEnableNotificationLogging()
Gets or sets a value indicating whether to enable the logging of notifications.
|
boolean |
isEnableObjectUnload()
Get or sets flag which enables document partially be unloaded from memory.
|
boolean |
isEncrypted()
Gets encrypted status of the document.
|
boolean |
isFitWindow()
Gets flag specifying whether document window must be resized to fit the first displayed page.
|
boolean |
isHandleSignatureChange()
Throw Exception if the document will save with changes and have signature
|
boolean |
isHideMenubar()
Gets flag specifying whether menu bar should be hidden when document is active.
|
boolean |
isHideToolBar()
Gets flag specifying whether toolbar should be hidden when document is active.
|
boolean |
isHideWindowUI()
Gets or sets flag specifying whether user interface elements should be hidden when document
is active.
|
static boolean |
isLicensed()
Gets licensed state of the system.
|
boolean |
isLinearized()
Gets or sets a value indicating whether document is linearized.
|
boolean |
isManualDisposeEnabled()
By default method save close internal streams and release memory resources.
|
boolean |
isPdfaCompliant()
Gets the is document pdfa compliant.
|
boolean |
isPdfUaCompliant()
Gets the is document pdfua compliant.
|
boolean |
isPickTrayByPdfSize()
Gets a flag specifying whether the PDF page size shall be used to select the input paper tray.
|
boolean |
isRepairNeeded(Document.RepairOptions[] options)
Checks if document requires Repair method call.
|
boolean |
isSkippedPdfaCompliantValidationBeforeSave()
By default pdfa validation process is necessary to update or remove pdfa compliant data if some rules were broken.
|
boolean |
isXrefGapsAllowed()
Gets or sets the is document pdfa compliant.
|
void |
loadFrom(String filename,
LoadOptions options)
Loads a file, converting it to PDF.
|
void |
merge(com.aspose.pdf.ADocument.MergeOptions mergeOptions,
Document... documents)
Merges documents.
|
void |
merge(com.aspose.pdf.ADocument.MergeOptions mergeOptions,
String... files)
Merges documents.
|
void |
merge(Document... documents)
Merges documents.
|
void |
merge(String... files)
Merges pdf files.
|
static Document |
mergeDocuments(com.aspose.pdf.ADocument.MergeOptions mergeOptions,
Document... files)
Merges documents.
|
static Document |
mergeDocuments(com.aspose.pdf.ADocument.MergeOptions mergeOptions,
String... files)
Merges documents.
|
static Document |
mergeDocuments(Document... documents)
Merges documents.
|
static Document |
mergeDocuments(String... files)
Merges pdf files.
|
void |
optimize()
Linearize the 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.
|
void |
optimizeResources()
Optimize resources in the document: 1.
|
void |
optimizeResources(OptimizationOptions strategy)
Optimize resources in the document according to defined optimization strategy.
|
void |
pageNodesToBalancedTree()
Organizes page tree nodes in a document into a balanced tree.
|
void |
pageNodesToBalancedTree(byte nodesNumInSubtrees)
Organizes page tree nodes in a document into a balanced tree.
|
static void |
preSave(PageCollection pages,
SaveOptions saveOptions)
Internal method
|
void |
processParagraphs()
Stores document into generator.
|
void |
removeMetadata()
Removes metadata from the document.
|
void |
removePdfaCompliance()
Remove pdfa compliance from the document
|
void |
removePdfUaCompliance()
Remove pdfUa compliance from the document
|
void |
repair()
Repairs broken document.
|
void |
repair(Document.RepairOptions options)
Repairs broken document.
|
void |
resumeUpdate()
resumes document update
|
void |
save()
Save document incrementally (i.e.
|
void |
save(javax.servlet.http.HttpServletResponse response,
String outputFileName,
ContentDisposition disposition,
SaveOptions options)
Saves the document to a response stream with a save options.
|
void |
save(OutputStream output)
Stores document into stream.
|
void |
save(OutputStream outputStream,
SaveFormat format)
Saves the document with a new name along with a file format.
|
void |
save(OutputStream outputStream,
SaveOptions options)
Saves the document with a new name setting its save options.
|
void |
save(SaveOptions options)
Saves the document with save options.
|
void |
save(com.aspose.ms.System.IO.Stream output)
For internal usage only
|
void |
save(String outputFileName)
Saves document into the specified file.
|
void |
save(String outputFileName,
SaveFormat format)
Saves the document with a new name along with a file format.
|
void |
save(String outputFileName,
SaveOptions options)
Saves the document with a new name setting its save options.
|
void |
saveIncrementally(OutputStream output)
Saves incrementally the PDF Document to the specified stream.
|
void |
saveIncrementally(com.aspose.ms.System.IO.Stream output)
Saves incrementally the PDF Document to the specified stream.
|
void |
saveIncrementally(String outputFileName)
Saves incrementally the PDF Document to the specified stream.
|
void |
saveXml(String file)
Save document to XML.
|
void |
sendTo(DocumentDevice device,
int fromPage,
int toPage,
OutputStream output)
Sends the certain pages of the document to the document device for processing.
|
void |
sendTo(DocumentDevice device,
int fromPage,
int toPage,
String outputFileName)
Sends the whole document to the document device for processing.
|
void |
sendTo(DocumentDevice device,
OutputStream output)
Sends the whole document to the document device for processing.
|
void |
sendTo(DocumentDevice device,
String outputFileName)
Sends the whole document to the document device for processing.
|
void |
setAbsentFontHandler(com.aspose.pdf.ADocument.AbsentFontHandler absentFontHandler)
Notification about missing fonts while processing documents.
|
void |
setAbsentFontTryToSubstitute(boolean substitute)
Setting the flag to replace the missing font.
|
void |
setAllowReusePageContent(boolean value)
Allows to merge page contents to optimize docuement size.
|
void |
setBackground(Color value)
Sets the background color of the document.
|
void |
setCenterWindow(boolean value)
Sets flag specifying whether position of the document's window will be centered on the
screen.
|
void |
setCollection(Collection value)
Sets collection of document.
|
void |
setConvertMetadataAndCatalogOnly(boolean value)
Gets convert parameter for pdf/ua converter (Convert only Metadata and Document Catalog if set true)
|
static void |
setDefaultFileSizeLimitToMemoryLoading()
Sets the file size limit for loading an entire file into memory to default value equals 210 Mb.
|
void |
setDirection(Direction value)
Sets reading order of text: L2R (left to right) or R2L (right to left).
|
void |
setDisableFontLicenseVerifications(boolean value)
Many operations with font can't be executed if these operations are prohibited by license of this font.
|
void |
setDisplayDocTitle(boolean value)
Sets flag specifying whether document's window title bar should display document title.
|
void |
setDuplex(int value)
Gets or sets print duplex mode handling option to use when printing the file from the print dialog.
|
void |
setEmbedStandardFonts(boolean value)
Property which declares that document must embed all standard Type1 fonts which has flag
IsEmbedded set into true.
|
void |
setEnableNotificationLogging(boolean value)
Gets or sets a value indicating whether to enable the logging of notifications.
|
void |
setEnableObjectUnload(boolean value)
Get or sets flag which enables document partially be unloaded from memory.
|
void |
setEnableSignatureSanitization(boolean value)
Gets or sets flag to manage signature fields sanitization.
|
static void |
setFileSizeLimitToMemoryLoading(int value)
Get and set the file size limit for loading an entire file into memory.
|
void |
setFitWindow(boolean value)
Sets flag specifying whether document window must be resized to fit the first displayed page.
|
void |
setHandleSignatureChange(boolean value)
Throw Exception if the document will save with changes and have signature
|
void |
setHideMenubar(boolean value)
Sets flag specifying whether menu bar should be hidden when document is active.
|
void |
setHideToolBar(boolean value)
Set flag specifying whether toolbar should be hidden when document is active.
|
void |
setHideWindowUI(boolean value)
Sets flag specifying whether user interface elements should be hidden when document is
active.
|
void |
setIgnoreCorruptedObjects(boolean value)
Gets or sets flag of ignoring errors in source files.
|
void |
setLinearized(boolean value)
Sets a value indicating whether document is linearized.
|
void |
setManualDisposeEnabled(boolean manualDisposeEnabled)
By default method save closes internal streams and release memory resources.
|
void |
setNonFullScreenPageMode(PageMode value)
Sets page mode, specifying how to display the document on exiting full-screen mode.
|
void |
setOpenAction(IAppointment value)
Sets action performed at document opening.
|
void |
setOptimizeSize(boolean value)
Sets optimization flag.
|
void |
setPageInfo(PageInfo value)
Sets the page info.(for generator only, not filled in when reading document)
|
void |
setPageLayout(PageLayout value)
Sets page layout which shall be used when the document is opened.
|
void |
setPageMode(PageMode pageMode)
Sets page mode, specifying how document should be displayed when opened.
|
void |
setPickTrayByPdfSize(boolean value)
Sets a flag specifying whether the PDF page size shall be used to select the input paper tray.
|
void |
setPrintScaling(int value)
Sets print scaling handling option to use when printing the file from the print dialog.
|
void |
setSkipPdfaCompliantValidationBeforeSave(boolean pdfaCompliantValidationBeforeSave)
By default pdfa validation process is necessary to update or remove pdfa if some rules were broken.
|
void |
setTitle(String title)
Set Title for Pdf Document
|
void |
setXmpMetadata(InputStream stream)
Set XMP metadata of document.
|
void |
setXrefGapsAllowed(boolean value)
Gets or sets the is document pdfa compliant.
|
void |
suppressUpdate()
Suppresses update contents data for all pages The contents is not updated until ResumeUpdate
is called
|
void |
updatePages()
updatePages
|
boolean |
validate(OutputStream outputLogStream,
PdfFormat format)
Validate document into the specified file.
|
boolean |
validate(PdfFormatConversionOptions options)
Validate document into the specified file.
|
boolean |
validate(String outputLogFileName,
PdfFormat format)
Validate document into the specified file.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitafterImport, bindXml, bindXml, bindXml, changePasswords, check, close, convert, convert, convert, convert, convert, convert, convert, convert, convert, convert, convertInternal, convertWithFlatten, convertWithSkippingErrors, decrypt, dispose, encrypt, encrypt, encrypt, exportAnnotationsToXfdf, flatten, flatten, flattenTransparency, freeMemory, getActions, getBackground, getCatalogValue, getCollection, getCryptoAlgorithm, getCustomSecurityHandler, getDefaultCopier, getDestinations, getDirection, getDuplex, getEmbeddedFiles, getEmbedStandardFonts, getEnableSignatureSanitization, getEngineDoc, getFileName, getForm, getId, getIgnoreCorruptedObjects, getInfo, getLogicalStructure, getMetadata, getMetadataStream, getNamedDestinations, getNonFullScreenPageMode, getObjectById, getOpenAction, getOptimizeSize, getOutlines, getPageInfo, getPageLabels, getPageLayout, getPageMode, getPages, getPdfFormat, getPermissions, getPrintScaling, getTaggedContent, getVersion, getXmpMetadata, importAnnotationsFromXfdf, isAbsentFontTryToSubstitute, isCenterWindow, isDisableFontLicenseVerifications, isDisplayDocTitle, isEncrypted, isFitWindow, isHideMenubar, isHideToolBar, isHideWindowUI, isLinearized, isManualDisposeEnabled, isPdfaCompliant, isPdfUaCompliant, isPickTrayByPdfSize, isXrefGapsAllowed, optimize, optimizeResources, optimizeResources, pageNodesToBalancedTree, pageNodesToBalancedTree, processParagraphs, removeMetadata, removePdfaCompliance, removePdfUaCompliance, repair, resumeUpdate, save, save, save, save, save, save, saveIncrementally, saveIncrementally, saveIncrementally, saveXml, sendTo, sendTo, sendTo, sendTo, setAbsentFontTryToSubstitute, setBackground, setCenterWindow, setCollection, setConvertMetadataAndCatalogOnly, setDirection, setDisableFontLicenseVerifications, setDisplayDocTitle, setDuplex, setEmbedStandardFonts, setEnableSignatureSanitization, setFitWindow, setHideMenubar, setHideToolBar, setHideWindowUI, setIgnoreCorruptedObjects, setLinearized, setManualDisposeEnabled, setNonFullScreenPageMode, setOpenAction, setOptimizeSize, setPageInfo, setPageLayout, setPageMode, setPickTrayByPdfSize, setPrintScaling, setTitle, setXmpMetadata, setXrefGapsAllowed, suppressUpdate, updatePages, validate, validatepublic static final byte DefaultNodesNumInSubtrees
public final PdfEvent<com.aspose.pdf.ADocument.FontSubstitutionHandler> FontSubstitution
It occurs when font replaces another font in document.
public DocumentWeb()
Initializes empty DocumentWeb.
public DocumentWeb(InputStream input)
Initialize new DocumentWeb instance from the input stream.
input - Stream with pdf DocumentWeb.public DocumentWeb(InputStream input, String password)
public DocumentWeb(InputStream input, LoadOptions options)
Opens an existing DocumentWeb from a stream providing necessary converting to get pdf DocumentWeb.
input - Input stream to convert into pdf DocumentWeb.options - Represents properties for converting input into pdf DocumentWeb.public DocumentWeb(String filename, LoadOptions options)
public DocumentWeb(String filename)
Just init DocumentWeb using filename. The same as DocumentWeb(Stream).
filename - The name of the pdf DocumentWeb file.public void save(javax.servlet.http.HttpServletResponse response,
String outputFileName,
ContentDisposition disposition,
SaveOptions options)
Saves the document to a response stream with a save options.
response - Encapsulates HTTP-response information.outputFileName - Simple file name, i.e. without path.disposition - Represents a MIME protocol Content-Disposition header.options - Save options.public com.aspose.pdf.engine.security.impl.handlers.ICustomSecurityHandler getCustomSecurityHandler()
Gets a custom security handler.
getCustomSecurityHandler in interface IDocumentpublic boolean isSkippedPdfaCompliantValidationBeforeSave()
public void setSkipPdfaCompliantValidationBeforeSave(boolean pdfaCompliantValidationBeforeSave)
pdfaCompliantValidationBeforeSave - boolean valuepublic JavaScriptCollection getJavaScript()
Collection of JavaScript of document level.
public final OutputIntents getOutputIntents()
Gets the collection of Output intents in the document.
public static boolean isLicensed()
Gets licensed state of the system. Returns true is system works in licensed mode and false otherwise.
public PageInfo getPageInfo()
getPageInfo in interface IDocumentpublic void setPageInfo(PageInfo value)
setPageInfo in interface IDocumentvalue - PageInfo objectpublic final boolean getEnableSignatureSanitization()
Gets or sets flag to manage signature fields sanitization. Enabled by default.
getEnableSignatureSanitization in interface IDocumentpublic final void setEnableSignatureSanitization(boolean value)
Gets or sets flag to manage signature fields sanitization. Enabled by default.
setEnableSignatureSanitization in interface IDocumentvalue - boolean valuepublic boolean isPdfaCompliant()
Gets the is document pdfa compliant.
isPdfaCompliant in interface IDocumentpublic boolean isPdfUaCompliant()
Gets the is document pdfua compliant.
isPdfUaCompliant in interface IDocumentpublic boolean isXrefGapsAllowed()
Gets or sets the is document pdfa compliant.
isXrefGapsAllowed in interface IDocumentpublic void setXrefGapsAllowed(boolean value)
Gets or sets the is document pdfa compliant.
setXrefGapsAllowed in interface IDocumentvalue - boolean valuepublic NamedDestinationCollection getNamedDestinations()
Collection of Named Destination in the document.
getNamedDestinations in interface IDocument@Deprecated public DestinationCollection getDestinations()
Gets the collection of destinations.
Obsolete. Please use NamedDestinations.getDestinations in interface IDocumentpublic PdfFormat getPdfFormat()
getPdfFormat in interface IDocumentPdfFormatpublic 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.
getEmbedStandardFonts in interface IDocumentpublic 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.
setEmbedStandardFonts in interface IDocumentvalue - boolean valuepublic final 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. By default false.
isDisableFontLicenseVerifications in interface IDocumentpublic final 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. By default false.
setDisableFontLicenseVerifications in interface IDocumentvalue - boolean value
By default false.public com.aspose.pdf.ADocument.AbsentFontHandler getAbsentFontHandler()
public void setAbsentFontHandler(com.aspose.pdf.ADocument.AbsentFontHandler absentFontHandler)
absentFontHandler - ADocument.AbsentFontHandler instancepublic void removePdfaCompliance()
Remove pdfa compliance from the document
removePdfaCompliance in interface IDocumentpublic void removePdfUaCompliance()
Remove pdfUa compliance from the document
removePdfUaCompliance in interface IDocumentpublic final void setTitle(String title)
Set Title for Pdf Document
public static void preSave(PageCollection pages, SaveOptions saveOptions)
pages - PageCollection instancesaveOptions - SaveOptions instancepublic Collection getCollection()
Gets collection of document.
getCollection in interface IDocumentpublic void setCollection(Collection value)
IDocumentsetCollection in interface IDocumentvalue - Collection objectpublic com.aspose.pdf.engine.IPdfDocument getEngineDoc()
IDocumentInstance of IPdfDocument used to access to internal document structure. Internal only
getEngineDoc in interface IDocumentpublic final void setConvertMetadataAndCatalogOnly(boolean value)
Gets convert parameter for pdf/ua converter (Convert only Metadata and Document Catalog if set true)
setConvertMetadataAndCatalogOnly in interface IDocumentvalue - boolean valuepublic String getVersion()
Gets a version of Pdf from Pdf file header.
getVersion in interface IDocumentpublic 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();
getOpenAction in interface IDocumentpublic void setOpenAction(IAppointment value)
Sets action performed at document opening.
setOpenAction in interface IDocumentvalue - IAppointment objectpublic 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();
isHideToolBar in interface IDocumentpublic void setHideToolBar(boolean value)
Set flag specifying whether toolbar should be hidden when document is active.
setHideToolBar in interface IDocumentvalue - boolean valuepublic 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();
isHideMenubar in interface IDocumentpublic void setHideMenubar(boolean value)
Sets flag specifying whether menu bar should be hidden when document is active.
setHideMenubar in interface IDocumentvalue - boolean valuepublic 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();
isHideWindowUI in interface IDocumentpublic void setHideWindowUI(boolean value)
Sets flag specifying whether user interface elements should be hidden when document is active.
setHideWindowUI in interface IDocumentvalue - boolean valuepublic 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();
isFitWindow in interface IDocumentpublic void setFitWindow(boolean value)
Sets flag specifying whether document window must be resized to fit the first displayed page.
setFitWindow in interface IDocumentvalue - boolean valuepublic boolean isCenterWindow()
Gets flag specifying whether position of the document's window will be centered on the screen.
Example demonstrates how to get CenterWindow flag:
Document document = new Document("sample.pdf");
boolean value = document.isCenterWindow();
isCenterWindow in interface IDocumentpublic void setCenterWindow(boolean value)
Sets flag specifying whether position of the document's window will be centered on the screen.
setCenterWindow in interface IDocumentvalue - boolean valuepublic 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();
isDisplayDocTitle in interface IDocumentpublic void setDisplayDocTitle(boolean value)
Sets flag specifying whether document's window title bar should display document title.
setDisplayDocTitle in interface IDocumentvalue - boolean valuepublic 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();
public OutlineCollection getOutlines()
Gets document outlines.
getOutlines in interface IDocumentpublic 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();
getActions in interface IDocumentpublic Form getForm()
Gets Acro Form of the document.
public EmbeddedFileCollection getEmbeddedFiles()
Gets collection of files embedded to document.
getEmbeddedFiles in interface IDocumentpublic Direction getDirection()
Gets reading order of text: L2R (left to right) or R2L (right to left).
getDirection in interface IDocumentDirectionpublic void setDirection(Direction value)
Sets reading order of text: L2R (left to right) or R2L (right to left).
setDirection in interface IDocumentvalue - Direction elementDirectionpublic PageMode getPageMode()
Gets page mode, specifying how document should be displayed when opened.
getPageMode in interface IDocumentPageModepublic void setPageMode(PageMode pageMode)
Sets page mode, specifying how document should be displayed when opened.
setPageMode in interface IDocumentpageMode - PageMode elementPageModepublic PageMode getNonFullScreenPageMode()
Gets page mode, specifying how to display the document on exiting full-screen mode.
getNonFullScreenPageMode in interface IDocumentPageModepublic void setNonFullScreenPageMode(PageMode value)
Sets page mode, specifying how to display the document on exiting full-screen mode.
setNonFullScreenPageMode in interface IDocumentvalue - PageMode elementPageModepublic PageLayout getPageLayout()
Gets page layout which shall be used when the document is opened.
getPageLayout in interface IDocumentPageLayoutpublic void setPageLayout(PageLayout value)
Sets page layout which shall be used when the document is opened.
setPageLayout in interface IDocumentvalue - PageLayout elementPageLayoutpublic int getDuplex()
Gets or sets print duplex mode handling option to use when printing the file from the print dialog.
public void setDuplex(int value)
Gets or sets print duplex mode handling option to use when printing the file from the print dialog.
public int getPrintScaling()
Gets print scaling handling option to use when printing the file from the print dialog.
getPrintScaling in interface IDocumentPrintScalingpublic void setPrintScaling(int value)
Sets print scaling handling option to use when printing the file from the print dialog.
setPrintScaling in interface IDocumentvalue - PrintDuplex elementPrintDuplexpublic final boolean isPickTrayByPdfSize()
Gets a flag specifying whether the PDF page size shall be used to select the input paper tray.
isPickTrayByPdfSize in interface IDocumentpublic final void setPickTrayByPdfSize(boolean value)
Sets a flag specifying whether the PDF page size shall be used to select the input paper tray.
setPickTrayByPdfSize in interface IDocumentvalue - boolean valuepublic String getFileName()
Name of the PDF file that caused this document
getFileName in interface IDocumentpublic DocumentInfo getInfo()
Gets document info.
public 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.)
getMetadata in interface IDocumentpublic RootElement getLogicalStructure()
Gets logical structure of the document.
getLogicalStructure in interface IDocumentpublic void processParagraphs()
Stores document into generator.
processParagraphs in interface IDocumentpublic void save(OutputStream output)
Stores document into stream.
public void saveIncrementally(OutputStream output)
saveIncrementally in interface IDocumentoutput - OutputStream objectpublic void saveIncrementally(com.aspose.ms.System.IO.Stream output)
saveIncrementally in interface IDocumentoutput - OutputStream objectpublic void saveIncrementally(String outputFileName)
saveIncrementally in interface IDocumentoutputFileName - OutputStream objectpublic void save(com.aspose.ms.System.IO.Stream output)
For internal usage only
output - For internal usage onlypublic boolean isManualDisposeEnabled()
isManualDisposeEnabled in interface IDocumentpublic void setManualDisposeEnabled(boolean manualDisposeEnabled)
setManualDisposeEnabled in interface IDocumentmanualDisposeEnabled - boolean value. (Default value == false)public void save(String outputFileName)
Saves document into the specified file.
Extensions doc, doc, html, xml, xlsx, Epub, pptx, pdf are automatically recognized for proper savingpublic void exportAnnotationsToXfdf(String fileName)
Exports all document annotations to XFDF file
exportAnnotationsToXfdf in interface IDocumentfileName - XFDF file namepublic final void exportAnnotationsToXfdf(OutputStream output)
Export all document annotations into stream.
output - Stream where store XFDF.public void sendTo(DocumentDevice device, OutputStream output)
Sends the whole document to the document device for processing.
public void sendTo(DocumentDevice device, int fromPage, int toPage, OutputStream output)
Sends the certain pages of the document to the document device for processing.
public void sendTo(DocumentDevice device, String outputFileName)
Sends the whole document to the document device for processing.
public void sendTo(DocumentDevice device, int fromPage, int toPage, String outputFileName)
Sends the whole document to the document device for processing.
public void removeMetadata()
Removes metadata from the document.
removeMetadata in interface IDocumentpublic void importAnnotationsFromXfdf(String fileName)
Imports annotations from XFDF file to document.
importAnnotationsFromXfdf in interface IDocumentfileName - XFDF file namepublic final void importAnnotationsFromXfdf(InputStream stream)
Imports annotations from stream to document.
stream - Stream contains XFDF data.public boolean validate(String outputLogFileName, PdfFormat format)
Validate document into the specified file.
public boolean convert(String outputLogFileName, PdfFormat format, ConvertErrorAction action, ConvertTransparencyAction transparencyAction)
Convert document and save errors into the specified file.
convert in interface IDocumentoutputLogFileName - Path to file where the comments will be stored.format - The pdf format.action - Action for objects that can not be convertedtransparencyAction - Action for image masked objectsPdfFormat,
ConvertErrorAction,
ConvertTransparencyActionpublic final boolean convert(OutputStream outputLogStream, PdfFormat format, ConvertErrorAction action, ConvertTransparencyAction transparencyAction)
Convert document and save errors into the specified file.
outputLogStream - Stream where the comments will be stored.format - The pdf format.action - Action for objects that can not be convertedtransparencyAction - Action for image masked objectspublic boolean convert(String outputLogFileName, PdfFormat format, ConvertErrorAction action)
Convert document and save errors into the specified file.
public boolean convert(PdfFormatConversionOptions options)
Convert document using specified conversion options
public byte[] convertPageToPNGMemoryStream(Page page)
Convert page to PNG for DSR, OMR, OCR image stream.
page - Page object to convert.public boolean validate(OutputStream outputLogStream, PdfFormat format)
Validate document into the specified file.
public boolean validate(PdfFormatConversionOptions options)
Validate document into the specified file.
options - set of options for convert PDF documentpublic boolean convert(Document.CallBackGetHocrBase callback)
public boolean convertWithSkippingErrors(Document.CallBackGetHocrBase callback)
convertWithSkippingErrors in interface IDocumentcallback - The call back procedure for hocr recognize.public boolean convertWithFlatten(Document.CallBackGetHocrBase callback)
convertWithFlatten in interface IDocumentcallback - The call back procedure for hocr recognize.public boolean convert(Document.CallBackGetHocrBase callback, boolean flattenImages)
This is allowing to show/hide searchable text. Default value is FALSE.
public boolean convert(Document.CallBackGetHocrBase callback, boolean isTextVisible, boolean flattenImages)
This is allowing to show/hide searchable text. Default value is FALSE.
public boolean convert(Document.CallBackGetHocrBase callback, boolean isTextVisible, boolean flattenImages, boolean isOriginalImage)
This is allowing to show/hide searchable text on page. Default value is FALSE. This is allowing to get original image from pdf. Default value is FALSE.
public boolean convert(Document.CallBackGetHocr callback, boolean isTextVisible, boolean flattenImages, boolean isOriginalImage, boolean skipErrorsInRecognitionHOCR)
This is allowing to show/hide searchable text on page. Default value is FALSE. This is allowing to get original image from pdf. Default value is FALSE.
public boolean convert(Document.CallBackGetHocrWithPage callback, boolean isTextVisible, boolean flattenImages, boolean isOriginalImage, boolean skipErrorsInRecognitionHOCR)
This is allowing to show/hide searchable text on page. Default value is FALSE. This is allowing to get original image from pdf. Default value is FALSE.
public boolean convertInternal(com.aspose.ms.System.IO.Stream outputLogStream,
PdfFormat format,
ConvertErrorAction action)
Convert document and save errors into the specified stream.
convertInternal in interface IDocumentoutputLogStream - Stream where the comments will be stored.format - Pdf format.action - The call back procedure for hocr recognize.public boolean convert(OutputStream outputLogStream, PdfFormat format, ConvertErrorAction action)
Convert document and save errors into the specified stream.
public boolean convert(Fixup fixup, OutputStream outputLog)
Convert document by applying the Fixup.
fixup - The Fixup type.outputLog - The log of process.Fixuppublic boolean convert(Fixup fixup, OutputStream outputLog, boolean onlyValidation, Object[] parameters)
Convert document by applying the Fixup.
fixup - The Fixup type.outputLog - The log of process.onlyValidation - Only document validation.parameters - Properties for Fixup that can not be set.Fixuppublic boolean convert(Fixup fixup, String outputLog)
Convert document by applying the Fixup.
fixup - The Fixup type.outputLog - The log of process.Fixuppublic boolean convert(Fixup fixup, String outputLog, boolean onlyValidation, Object[] parameters)
Convert document by applying the Fixup.
fixup - The Fixup type.outputLog - The log of process.onlyValidation - Only document validation.parameters - Properties for Fixup that can not be set.Fixuppublic final boolean isHandleSignatureChange()
Throw Exception if the document will save with changes and have signature
public final void setHandleSignatureChange(boolean value)
Throw Exception if the document will save with changes and have signature
value - boolean valuepublic final void loadFrom(String filename, LoadOptions options)
Loads a file, converting it to PDF.
filename - The path to the file to open.options - The load options.PdfException - If the file cannot be loaded.com.aspose.ms.System.IO.FileNotFoundException - If the file is not found.public static void convert(String srcFileName, LoadOptions loadOptions, String dstFileName, SaveOptions saveOptions)
Converts source file in source format into destination file in destination format.
srcFileName - The source file name.loadOptions - The source file format.dstFileName - The destination file name.saveOptions - The destination file format.public static void convert(InputStream srcStream, LoadOptions loadOptions, String dstFileName, SaveOptions saveOptions)
Converts stream in source format into destination file in destination format.
srcStream - The source stream.loadOptions - The source stream format.dstFileName - The destination file name.saveOptions - The destination file format.public static void convert(String srcFileName, LoadOptions loadOptions, OutputStream dstStream, SaveOptions saveOptions)
Converts source file in source format into stream in destination format.
srcFileName - The source file name.loadOptions - The source file format.dstStream - The destination stream.saveOptions - The destination stream format.public static void convert(InputStream srcStream, LoadOptions loadOptions, OutputStream dstStream, SaveOptions saveOptions)
Converts stream in source format into stream in destination format.
srcStream - The source stream.loadOptions - The source stream format.dstStream - The destination stream.saveOptions - The destination file format.public void flatten()
Removes all fields (and annotations) from the document and place their values instead.
public void flatten(Form.FlattenSettings flattenSettings)
Removes all fields from the document and place their values instead.
public void flattenTransparency()
Replaces transparent content with non-transparent raster and vector graphics.
flattenTransparency in interface IDocumentpublic CryptoAlgorithm getCryptoAlgorithm()
Gets security settings if document is encrypted. If document is not encrypted then corresponding exception will be raised in .net 1.1 or CryptoAlgorithm will be null for other .net versions.
getCryptoAlgorithm in interface IDocumentCryptoAlgorithmpublic final void encrypt(int permissions,
CryptoAlgorithm cryptoAlgorithm,
com.aspose.ms.System.Collections.Generic.IGenericList<com.aspose.ms.System.Security.Cryptography.X509Certificates.X509Certificate2> publicCertificates)
Encrypts the document.
permissions - Document permissions, see Permissions(getPermissions()) for details.cryptoAlgorithm - Cryptographic algorithm, see CryptoAlgorithm(getCryptoAlgorithm()) for details.publicCertificates - The public certificates used for encryption — one per recipient.
This method prepares for encryption. To encrypt a document, you need to call the Save method to save it.
public final void encrypt(String userPassword, String ownerPassword, DocumentPrivilege privileges, com.aspose.pdf.engine.security.impl.handlers.ICustomSecurityHandler customHandler)
Encrypts the document.
userPassword - User password.ownerPassword - Owner password.privileges - Document permissions, see Permissions(getPermissions()) for details.customHandler - The custom security handler.
This method prepares for encryption. To encrypt a document, you need to call the Save method to save it.
public final void encrypt(String userPassword, String ownerPassword, int permissions, com.aspose.pdf.engine.security.impl.handlers.ICustomSecurityHandler customHandler)
Encrypts the document.
userPassword - User password.ownerPassword - Owner password.permissions - Document permissions, see Permissions(getPermissions()) for details.customHandler - The custom security handler.public void encrypt(String userPassword, String ownerPassword, DocumentPrivilege privileges, CryptoAlgorithm cryptoAlgorithm, boolean usePdf20)
Encrypts the document.
encrypt in interface IDocumentuserPassword - User password.ownerPassword - Owner password.privileges - Document permissions, see Permissions for details.cryptoAlgorithm - Cryptographic algorithm, see CryptoAlgorithm for details.usePdf20 - Support for revision 6 (Extension 8).
This method prepares for encryption. To encrypt a document, you need to call the Save method to save it.
CryptoAlgorithmpublic void encrypt(String userPassword, String ownerPassword, int permissions, CryptoAlgorithm cryptoAlgorithm)
Encrypts the document.
encrypt in interface IDocumentuserPassword - User password.ownerPassword - Owner password.permissions - Document permissions, see Permissions for details.cryptoAlgorithm - Cryptographic algorithm, see CryptoAlgorithm for details.
This method prepares for encryption. To encrypt a document, you need to call the Save method to save it.
Permissions,
CryptoAlgorithmpublic void encrypt(String userPassword, String ownerPassword, int permissions, CryptoAlgorithm cryptoAlgorithm, boolean usePdf20)
Encrypts the document.
encrypt in interface IDocumentuserPassword - User password.ownerPassword - Owner password.permissions - Document permissions, see Permissions for details.cryptoAlgorithm - Cryptographic algorithm, see CryptoAlgorithm for details.usePdf20 - Support for revision 6 (Extension 8).
This method prepares for encryption. To encrypt a document, you need to call the Save method to save it.
Permissions,
CryptoAlgorithmpublic void changePasswords(String ownerPassword, String newUserPassword, String newOwnerPassword)
Changes document passwords. This action can be done only using owner password.
changePasswords in interface IDocumentownerPassword - Owner password.newUserPassword - New user password.newOwnerPassword - New owner password.public boolean isLinearized()
Gets or sets a value indicating whether document is linearized.
isLinearized in interface IDocumentpublic void setLinearized(boolean value)
IDocumentSets a value indicating whether document is linearized.
setLinearized in interface IDocumentvalue - boolean valuepublic void decrypt()
Decrypts the document. Call then Save to obtain decrypted version of the document.
public int getPermissions()
Gets permissions of the document.
getPermissions in interface IDocumentpublic boolean isEncrypted()
Gets encrypted status of the document. True if document is encrypted.
isEncrypted in interface IDocumentpublic void optimize()
Linearize the 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.
public void save()
Save document incrementally (i.e. using incremental update technque).
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.public final void save(SaveOptions options)
Saves the document with save options.
options - Save options.public void save(String outputFileName, SaveFormat format)
Saves the document with a new name along with a file format.
outputFileName - Path to file where the document will be stored.format - Format options.SaveFormatpublic void save(OutputStream outputStream, SaveFormat format)
Saves the document with a new name along with a file format.
save in interface IDocumentoutputStream - Stream where the document will be stored.format - Format options.com.aspose.ms.System.ArgumentException - ArgumentException when HtmlSaveOptions is passed to a method. Save a
document
to the html stream is not supported. Please use method save to the file.SaveFormatpublic void save(String outputFileName, SaveOptions options)
Saves the document with a new name setting its save options.
public void save(OutputStream outputStream, SaveOptions options)
IDocumentSaves the document with a new name setting its save options.
public com.aspose.pdf.engine.data.types.IPdfStreamAccessor getMetadataStream()
Returns raw metadata stream
getMetadataStream in interface IDocumentpublic void updatePages()
IDocumentupdatePages in interface IDocumentpublic void suppressUpdate()
suppressUpdate in interface IDocumentpublic void resumeUpdate()
resumeUpdate in interface IDocumentpublic void close()
Closes all resources used by this document.
@Deprecated public void dispose()
Closes all resources used by this document.
This method is obsolete, use close() instead.public Color getBackground()
Gets the background color of the document.
getBackground in interface IDocumentpublic void setBackground(Color value)
Sets the background color of the document.
setBackground in interface IDocumentvalue - java.awt.Color objectpublic Copier getDefaultCopier()
Returns copier used for coping pages to this document.
getDefaultCopier in interface IDocumentpublic 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 in interface IDocumentpublic void optimizeResources(OptimizationOptions strategy)
Optimize resources in the document according to defined optimization strategy.
optimizeResources in interface IDocumentstrategy - Optimization strategy.public boolean getOptimizeSize()
getOptimizeSize in interface IDocumentpublic void setOptimizeSize(boolean value)
setOptimizeSize in interface IDocumentvalue - boolean valuepublic boolean getAllowReusePageContent()
Allows to merge page contents to optimize docuement size. If used then differnet but duplicated pages may reference to the same content object. Please note that this mode may cause side effects like changing page content when other page is changed.
public void setAllowReusePageContent(boolean value)
Allows to merge page contents to optimize docuement size. If used then differnet but duplicated pages may reference to the same content object. Please note that this mode may cause side effects like changing page content when other page is changed.
value - boolean valuepublic boolean getIgnoreCorruptedObjects()
getIgnoreCorruptedObjects in interface IDocumentpublic void setIgnoreCorruptedObjects(boolean value)
setIgnoreCorruptedObjects in interface IDocumentvalue - boolean valuespublic Object getCatalogValue(String key)
Returns item value from catalog dictionary.
getCatalogValue in interface IDocumentkey - The key of item.public PageLabelCollection getPageLabels()
getPageLabels in interface IDocumentpublic void freeMemory()
Clears memory
freeMemory in interface IDocumentpublic void afterImport()
Enumerate all registered annotations and call AfterImport for each of them. InternalMethod
afterImport in interface IDocumentpublic void saveXml(String file)
Save document to XML.
public Object getObjectById(String id)
Gets a object with specified ID in the document.
getObjectById in interface IDocumentid - The object id.public void bindXml(InputStream stream)
Bind xml to document
public void bindXml(String file)
Bind xml to document
public final boolean isRepairNeeded(Document.RepairOptions[] options)
Checks if document requires Repair method call.
options - Filled RepairOptions recommended to be used in Repair methodpublic final void repair(Document.RepairOptions options)
Repairs broken document.
options - An optional parameter of type Document.RepairOptions to specify repair settings.
If not provided, default settings will be used.public void bindXml(InputStream xmlStream, InputStream xslStream)
Bind xml/xsl to document
xmlStream - The xml stream.xslStream - The xsl stream if XSLT is used.public void bindXml(InputStream xmlStream, InputStream xslStream, com.aspose.ms.System.Xml.XmlReaderSettings settings)
Bind xml/xsl to document
xmlStream - The xml stream.xslStream - The xsl stream if XSLT is used.settings - The xml reader settings.public void getXmpMetadata(OutputStream output)
Get XMP metadata from document.
getXmpMetadata in interface IDocumentoutput - Stream where metadata will be stored.public void setXmpMetadata(InputStream stream)
Set XMP metadata of document.
setXmpMetadata in interface IDocumentstream - Stream which contains XMP metadata.public boolean isEnableObjectUnload()
Get or sets flag which enables document partially be unloaded from memory. This allow to decrease memory usage but may have negative effect on performance.
public void setEnableObjectUnload(boolean value)
Get or sets flag which enables document partially be unloaded from memory. This allow to decrease memory usage but may have negative effect on performance.
value - boolean valuepublic boolean isAbsentFontTryToSubstitute()
isAbsentFontTryToSubstitute in interface IDocumentpublic void setAbsentFontTryToSubstitute(boolean substitute)
setAbsentFontTryToSubstitute in interface IDocumentsubstitute - boolean valuepublic boolean check(boolean doRepair)
public ITaggedContent getTaggedContent()
Gets access to TaggedPdf content.
The example demonstrates how to use tagged content for creating new document with header, paragraphs and images.
// Create new document
Document document = new Document();
// Get the tagged content
ITaggedContent taggedContent = document.getTaggedContent();
// Set language for document
taggedContent.setLanguage("en-US");
// Set title for PDF document
taggedContent.setTitle("Example document");
// Creating and adding Section
SectElement sect = taggedContent.createSectElement();
taggedContent.getRootElement().appendChild(sect);
// Create Header
HeaderElement h1 = taggedContent.createHeaderElement(1);
h1.setText("The Header");
sect.appendChild(h1);
// Create paragraph
ParagraphElement p = taggedContent.createParagraphElement();
p.setTag("Paragraph");
p.setText("The text of paragraph.");
sect.appendChild(p);
// Create illustration
IllustrationElement figure1 = taggedContent.createFigureElement();
sect.appendChild(figure1);
figure1.setAlternativeText("Figure 1");
figure1.setTitle("Image 1");
figure1.setTag("Fig");
figure1.setImage("path/of/image.jpg");
// Save document
document.save("example.pdf");
getTaggedContent in interface IDocumentpublic 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. Do not call this method while iterating over Pages elements, it may give unpredictable results
pageNodesToBalancedTree in interface IDocumentpublic 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. Do not call this method while iterating over Pages elements, it may give unpredictable results
pageNodesToBalancedTree in interface IDocumentnodesNumInSubtrees - Desired number of subnodes. Default value is ten.public final void merge(com.aspose.pdf.ADocument.MergeOptions mergeOptions,
Document... documents)
Merges documents.
mergeOptions - The merge options.documents - The documents to merge.public final void merge(com.aspose.pdf.ADocument.MergeOptions mergeOptions,
String... files)
Merges documents.
mergeOptions - The merge options.files - The pdf-files to merge.public final void merge(Document... documents)
Merges documents.
documents - The documents to merge.public final void merge(String... files)
Merges pdf files.
files - The pdf-files to merge.public static int getFileSizeLimitToMemoryLoading()
Get and set the file size limit for loading an entire file into memory. The value is set in megabytes. The default value is 210 Mb.
public static void setFileSizeLimitToMemoryLoading(int value)
Get and set the file size limit for loading an entire file into memory. The value is set in megabytes. The default value is 210 Mb.
value - int valuepublic final boolean isEnableNotificationLogging()
Gets or sets a value indicating whether to enable the logging of notifications.
public final void setEnableNotificationLogging(boolean value)
Gets or sets a value indicating whether to enable the logging of notifications.
value - boolean valuepublic static void setDefaultFileSizeLimitToMemoryLoading()
Sets the file size limit for loading an entire file into memory to default value equals 210 Mb.
public static Document mergeDocuments(com.aspose.pdf.ADocument.MergeOptions mergeOptions, String... files)
Merges documents.
mergeOptions - The merge options.files - The pdf-files to merge.public static Document mergeDocuments(com.aspose.pdf.ADocument.MergeOptions mergeOptions, Document... files)
Merges documents.
mergeOptions - MergeOptions instancefiles - The documents to merge.public static Document mergeDocuments(String... files)
Merges pdf files.
files - The pdf-files to merge.public static Document mergeDocuments(Document... documents)
Merges documents.
documents - The documents to merge.public final boolean hasIncrementalUpdate()
Checks if the current PDF document has been saved with incremental updates.
true if the PDF document has incremental updates; otherwise, false.Copyright © 2025 Aspose. All Rights Reserved.