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 interface |
Document.CallBackGetHocr
The call back procedure for hocr recognize.
|
static interface |
Document.IDocumentFontUtilities
Holds functionality to tune fonts
|
static class |
Document.OptimizationOptions
Deprecated.
This class is obsolete. Please use com.aspose.pdf.optimization.OptimizationOptions instead.
|
Modifier and Type | Field and Description |
---|---|
com.aspose.pdf.ADocument.AbsentFontHandler |
AbsentFontHandler
Notification about missing fonts while processing documents.
|
PdfEvent<com.aspose.pdf.ADocument.FontSubstitutionHandler> |
FontSubstitution
It occurs when font replaces another font in document.
|
Constructor and Description |
---|
Document()
Initializes empty document.
|
Document(InputStream input)
Initialize new Document instance from the
input stream. |
Document(InputStream input,
boolean isManagedStream)
Initialize new Document instance from the
input stream. |
Document(InputStream input,
LoadOptions options)
Opens an existing document from a stream providing necessary converting to get pdf document.
|
Document(InputStream input,
String password)
Initialize new Document instance from the
input stream. |
Document(InputStream input,
String password,
boolean isManagedStream)
Initialize new Document instance from the
input stream. |
Document(com.aspose.ms.System.IO.Stream input)
Initialize new Document instance from the
input stream. |
Document(com.aspose.ms.System.IO.Stream input,
String password)
Opens an existing document from a stream.
|
Document(String filename)
Just init Document using
filename . |
Document(String filename,
LoadOptions options)
Opens an existing document from a file providing necessary converting to get pdf document.
|
Document(String filename,
String password)
Initializes new instance of the
Document class for working with encrypted document. |
Document(String filename,
String password,
boolean isManagedStream)
Initializes new instance of the
Document class for working with encrypted document. |
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.CallBackGetHocr callback)
Convert document and save errors into the specified file.
|
boolean |
convert(Document.CallBackGetHocr callback,
boolean isTestVisible)
Convert document and save errors into the specified file.
|
boolean |
convert(Document.CallBackGetHocr callback,
boolean isTextVisible,
boolean isOriginalImage)
Convert document and save errors into the specified file.
|
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,
int format,
int action)
Convert document and save errors into the specified stream.
|
boolean |
convert(OutputStream outputLogStream,
int format,
int action,
int transparencyAction)
Convert document and save errors into the specified file.
|
boolean |
convert(PdfFormatConversionOptions options)
Convert document using specified conversion options
|
boolean |
convert(String outputLogFileName,
int format,
int action)
Convert document and save errors into the specified file.
|
boolean |
convert(String outputLogFileName,
int format,
int action,
int transparencyAction)
Convert document and save errors into the specified file.
|
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 |
convertInternal(com.aspose.ms.System.IO.Stream outputLogStream,
int format,
int action)
Convert document and save errors into the specified stream.
|
byte[] |
convertPageToPNGMemoryStream(Page page)
Convert page to PNG for DSR, OMR , OCR
|
void |
decrypt()
Decrypts the document.
|
void |
dispose()
Closes all resources used by this document.
|
void |
encrypt(String userPassword,
String ownerPassword,
DocumentPrivilege privileges,
int cryptoAlgorithm,
boolean usePdf20)
Encrypts the document.
|
void |
encrypt(String userPassword,
String ownerPassword,
int permissions,
int cryptoAlgorithm)
Encrypts the document.
|
void |
encrypt(String userPassword,
String ownerPassword,
int permissions,
int cryptoAlgorithm,
boolean usePdf20)
Encrypts the document.
|
static void |
endOperation() |
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 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 |
freeMemory()
Clears memory
|
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.
|
int |
getCryptoAlgorithm()
Gets security settings if document is encrypted.
|
Copier |
getDefaultCopier()
Returns copier used for coping pages to this document.
|
DestinationCollection |
getDestinations()
Gets the collection of destinations.
|
int |
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.
|
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
|
Document.IDocumentFontUtilities |
getFontUtilities()
IDocumentFontUtilities instance
|
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()
Returns raw metadata stream
|
NamedDestinationCollection |
getNamedDestinations()
Collection of Named Destination in the document.
|
int |
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.
|
PageInfo |
getPageInfo()
Gets the page info.
|
PageLabelCollection |
getPageLabels()
Gets page labels in the document.
|
int |
getPageLayout()
Gets page layout which shall be used when the document is opened.
|
int |
getPageMode()
Gets page mode, specifying how document should be displayed when opened.
|
PageCollection |
getPages()
Gets collection of document pages.
|
int |
getPdfFormat()
Gets pdfa format
|
int |
getPermissions()
Gets permissions of the document.
|
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.
|
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 |
isDisplayDocTitle()
Gets flag specifying whether document's window title bar should display document title.
|
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 |
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 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 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 |
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 |
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.
|
void |
optimizeResources()
Optimize resources in the document: 1.
|
void |
optimizeResources(Document.OptimizationOptions strategy)
Optimize resources in the document according to defined optimization strategy.
|
void |
optimizeResources(OptimizationOptions strategy)
Optimize resources in the document according to defined optimization strategy.
|
static void |
preSave(PageCollection pages,
SaveOptions saveOptions)
Internal method
|
void |
processParagraphs()
Stores document into stream.
|
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 |
resumeUpdate()
resumes document update
|
void |
save()
Save document incrementally (i.e. using incremental update technique).
|
void |
save(com.aspose.ms.System.IO.FileStream output) |
void |
save(OutputStream output)
Stores document into stream.
|
void |
save(OutputStream outputStream,
int format)
Saves the document with a new name along with a file format.
|
void |
save(OutputStream outputStream,
SaveOptions options)
Saves the document to a stream with a save options.
|
void |
save(String outputFileName)
Saves document into the specified file.
|
void |
save(String outputFileName,
int 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(String outputFileName)
Saves incrementally the PDF Document to the specified stream.
|
void |
saveInternal(com.aspose.ms.System.IO.Stream output)
For internal usage only
|
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 |
setAbsentFontTryToSubstitute(boolean setAbsentFontTryToSubstitute)
Setting flag for set program determined font in case of absense 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)
|
void |
setDirection(int value)
Sets reading order of text: L2R (left to right) or R2L (right to left).
|
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 |
setEnableObjectUnload(boolean value)
Get or sets flag which enables document partially be unloaded from memory.
|
void |
setFitWindow(boolean value)
Sets flag specifying whether document window must be resized to fit the first displayed page.
|
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 |
setLayersAdded(boolean value)
Set LayersAdded value
|
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(int 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.
|
void |
setPageLayout(int value)
Sets page layout which shall be used when the document is opened.
|
void |
setPageMode(int pageMode)
Sets page mode, specifying how document should be displayed when opened.
|
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.
|
static void |
startOperation() |
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,
int format)
Validate document into the specified file.
|
boolean |
validate(PdfFormatConversionOptions options)
Validate document into the specified file.
|
boolean |
validate(String outputLogFileName,
int format)
Validate document into the specified file.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterImport, bindXml, bindXml, bindXml, close, convert, convert, getDuplex, getEmbedStandardFonts, getNamedDestinations, getObjectById, getXmpMetadata, isPdfaCompliant, isPdfUaCompliant, isXrefGapsAllowed, optimizeResources, removePdfUaCompliance, repair, saveXml, setConvertMetadataAndCatalogOnly, setDuplex, setEmbedStandardFonts, setLayersAdded, setTitle, setXmpMetadata, setXrefGapsAllowed, updatePages
public com.aspose.pdf.ADocument.AbsentFontHandler AbsentFontHandler
public final PdfEvent<com.aspose.pdf.ADocument.FontSubstitutionHandler> FontSubstitution
It occurs when font replaces another font in document.
public Document()
Initializes empty document.
public Document(InputStream input)
Initialize new Document instance from the input
stream.
input
- Stream with pdf document.public Document(InputStream input, String password)
Initialize new Document instance from the input
stream.
input
- Input stream object, corresponding pdf is password protected.password
- User or owner password.public Document(com.aspose.ms.System.IO.Stream input)
Initialize new Document instance from the input
stream.
input
- Stream with pdf document.public Document(InputStream input, String password, boolean isManagedStream)
Initialize new Document instance from the input
stream.
input
- Stream with pdf document.password
- User or owner password.isManagedStream
- if set to true
inner stream is closed before exit; otherwise, is not.public Document(InputStream input, boolean isManagedStream)
Initialize new Document instance from the input
stream.
input
- Stream with pdf document.isManagedStream
- if set to true
inner stream is closed before exit; otherwise, is not.public Document(InputStream input, LoadOptions options)
Opens an existing document from a stream providing necessary converting to get pdf document.
input
- Input stream to convert into pdf document.options
- Represents properties for converting input
into pdf document.public Document(String filename, LoadOptions options)
Opens an existing document from a file providing necessary converting to get pdf document.
filename
- Input file to convert into pdf document.options
- Represents properties for converting filename
into pdf document.public Document(com.aspose.ms.System.IO.Stream input, String password)
Opens an existing document from a stream.
input
- Input file to convert into pdf document.password
- User or owner password.public Document(String filename)
Just init Document using filename
. The same as Document(Stream)
.
filename
- The name of the pdf document file.public Document(String filename, String password)
Initializes new instance of the Document
class for working with encrypted document.
filename
- Document file name.password
- User or owner password.public Document(String filename, String password, boolean isManagedStream)
Initializes new instance of the Document
class for working with encrypted document.
filename
- Document file name.password
- User or owner password.isManagedStream
- if set to true
inner stream is closed before exit; otherwise, is not.public PageInfo getPageInfo()
Gets the page info.(for generator only)
getPageInfo
in interface IDocument
public void setPageInfo(PageInfo value)
Sets the page info.(for generator only)
setPageInfo
in interface IDocument
value
- PageInfo objectpublic DestinationCollection getDestinations()
Gets the collection of destinations.
getDestinations
in interface IDocument
public int getPdfFormat()
Gets pdfa format
getPdfFormat
in interface IDocument
PdfFormat
public Document.IDocumentFontUtilities getFontUtilities()
IDocumentFontUtilities instance
public void removePdfaCompliance()
Remove pdfa compliance from the document
removePdfaCompliance
in interface IDocument
public Collection getCollection()
Gets collection of document.
getCollection
in interface IDocument
public void setCollection(Collection value)
Sets collection of document.
setCollection
in interface IDocument
value
- Collection objectpublic com.aspose.pdf.engine.IPdfDocument getEngineDoc()
Instance of IPdfDocument used to access to internal document structure. Internal only
getEngineDoc
in interface IDocument
public String getVersion()
Gets a version of Pdf from Pdf file header.
getVersion
in interface IDocument
public 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 IDocument
public void setOpenAction(IAppointment value)
Sets action performed at document opening.
setOpenAction
in interface IDocument
value
- IAppointment valuepublic boolean isHideToolBar()
Gets flag specifying whether toolbar should be hidden when document is active.
isHideToolBar
in interface IDocument
Example demonstrates how to get HideToolBar flag: Document document = new Document("sample.pdf"); boolean value = document.isHideToolBar();
public void setHideToolBar(boolean value)
Set flag specifying whether toolbar should be hidden when document is active.
setHideToolBar
in interface IDocument
value
- boolean valuepublic boolean isHideMenubar()
Gets flag specifying whether menu bar should be hidden when document is active.
isHideMenubar
in interface IDocument
Example demonstrates how to get HideMenubar flag: Document document = new Document("sample.pdf"); boolean value = document.isHideMenubar();
public void setHideMenubar(boolean value)
Sets flag specifying whether menu bar should be hidden when document is active.
setHideMenubar
in interface IDocument
value
- boolean valuepublic boolean isHideWindowUI()
Gets flag specifying whether user interface elements should be hidden when document is active.
isHideWindowUI
in interface IDocument
Example demonstrates how to get HideWindowUI flag: Document document = new Document("sample.pdf"); boolean value = document.isHideWindowUI();
public void setHideWindowUI(boolean value)
Sets flag specifying whether user interface elements should be hidden when document is active.
setHideWindowUI
in interface IDocument
value
- boolean valuepublic boolean isFitWindow()
Gets flag specifying whether document window must be resized to fit the first displayed page.
isFitWindow
in interface IDocument
Example demonstrates how to get FitWindow flag: Document document = new Document("sample.pdf"); boolean value = document.isFitWindow();
public void setFitWindow(boolean value)
Sets flag specifying whether document window must be resized to fit the first displayed page.
setFitWindow
in interface IDocument
value
- boolean valuepublic boolean isCenterWindow()
Gets flag specifying whether position of the document's window will be centered on the screen.
isCenterWindow
in interface IDocument
Example demonstrates how to get CenterWindow flag: Document document = new Document("sample.pdf"); boolean value = document.isCenterWindow();
public void setCenterWindow(boolean value)
Sets flag specifying whether position of the document's window will be centered on the screen.
setCenterWindow
in interface IDocument
value
- boolean valuepublic boolean isDisplayDocTitle()
Gets flag specifying whether document's window title bar should display document title.
isDisplayDocTitle
in interface IDocument
Example demonstrates how to get DisplayDocTitle flag: Document document = new Document("sample.pdf"); boolean value = document.isDisplayDocTitle();
public void setDisplayDocTitle(boolean value)
Sets flag specifying whether document's window title bar should display document title.
setDisplayDocTitle
in interface IDocument
value
- boolean valuepublic PageCollection getPages()
Gets collection of document pages. Note that pages are numbered from 1 in collection.
getPages
in interface IDocument
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"); PageCollection 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 IDocument
public DocumentActionCollection getActions()
Gets document actions. This property is instance of DocumentActions class which allows to get/set BeforClosing, BeforSaving, etc. actions.
getActions
in interface IDocument
This example demonstrates how to obtain after open action of the document: Document document = new Document("PdfWithOpenAction.pdf"); DocumentActionCollection actions = document.getActions(); PdfAction afterSavingAction = actions.getAfterSaving();
public Form getForm()
Gets Acro Form of the document.
public EmbeddedFileCollection getEmbeddedFiles()
Gets collection of files embedded to document.
getEmbeddedFiles
in interface IDocument
public int getDirection()
Gets reading order of text: L2R (left to right) or R2L (right to left).
getDirection
in interface IDocument
Direction
public void setDirection(int value)
Sets reading order of text: L2R (left to right) or R2L (right to left).
setDirection
in interface IDocument
value
- int valueDirection
public int getPageMode()
Gets page mode, specifying how document should be displayed when opened.
getPageMode
in interface IDocument
PageMode
public void setPageMode(int pageMode)
Sets page mode, specifying how document should be displayed when opened.
setPageMode
in interface IDocument
pageMode
- int valuePageMode
public int getNonFullScreenPageMode()
Gets page mode, specifying how to display the document on exiting full-screen mode.
getNonFullScreenPageMode
in interface IDocument
PageMode
public void setNonFullScreenPageMode(int value)
Sets page mode, specifying how to display the document on exiting full-screen mode.
setNonFullScreenPageMode
in interface IDocument
value
- int valuePageMode
public int getPageLayout()
Gets page layout which shall be used when the document is opened.
getPageLayout
in interface IDocument
PageLayout
public void setPageLayout(int value)
Sets page layout which shall be used when the document is opened.
setPageLayout
in interface IDocument
value
- int valuePageLayout
public String getFileName()
Name of the PDF file that caused this document
getFileName
in interface IDocument
public 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 IDocument
public RootElement getLogicalStructure()
Gets logical structure of the document.
getLogicalStructure
in interface IDocument
public void processParagraphs()
Stores document into stream.
processParagraphs
in interface IDocument
public void saveInternal(com.aspose.ms.System.IO.Stream output)
For internal usage only
output
- For internal usage onlypublic void save(OutputStream output)
Stores document into stream.
public void save(String outputFileName)
Saves document into the specified file.
public void exportAnnotationsToXfdf(String fileName)
Exports all document annotations to XFDF file
exportAnnotationsToXfdf
in interface IDocument
fileName
- XFDF file namepublic 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 IDocument
public void importAnnotationsFromXfdf(String fileName)
Imports annotations from XFDF file to document.
importAnnotationsFromXfdf
in interface IDocument
fileName
- XFDF file namepublic boolean validate(String outputLogFileName, int format)
Validate document into the specified file.
public boolean convert(String outputLogFileName, int format, int action)
Convert document and save errors into the specified file.
public boolean validate(OutputStream outputLogStream, int format)
public boolean convert(String outputLogFileName, int format, int action, int transparencyAction)
Convert document and save errors into the specified file.
convert
in interface IDocument
outputLogFileName
- 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
,
ConvertTransparencyAction
public boolean convert(Document.CallBackGetHocr callback)
public boolean convertInternal(com.aspose.ms.System.IO.Stream outputLogStream, int format, int action)
Convert document and save errors into the specified stream.
convertInternal
in interface IDocument
outputLogStream
- Stream where the comments will be stored.format
- Pdf format.action
- Action for objects that can not be convertedpublic boolean convert(OutputStream outputLogStream, int format, int action)
Convert document and save errors into the specified stream.
public boolean convert(PdfFormatConversionOptions options)
Convert document using specified conversion options
public void flatten()
Removes all fields from the document and place their values instead.
public int 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 IDocument
CryptoAlgorithm
public void encrypt(String userPassword, String ownerPassword, DocumentPrivilege privileges, int cryptoAlgorithm, boolean usePdf20)
Encrypts the document. Call then Save to get encrypted version of the document.
encrypt
in interface IDocument
userPassword
- 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).CryptoAlgorithm
public void encrypt(String userPassword, String ownerPassword, int permissions, int cryptoAlgorithm)
Encrypts the document. Call then Save to get encrypted version of the document.
public void encrypt(String userPassword, String ownerPassword, int permissions, int cryptoAlgorithm, boolean usePdf20)
Encrypts the document. Call then Save to get encrypted version of the document.
encrypt
in interface IDocument
userPassword
- 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).Permissions
,
CryptoAlgorithm
public void changePasswords(String ownerPassword, String newUserPassword, String newOwnerPassword)
Changes document passwords. This action can be done only using owner password.
changePasswords
in interface IDocument
ownerPassword
- Owner password.newUserPassword
- New user password.newOwnerPassword
- New owner password.public boolean isLinearized()
Gets a value indicating whether document is linearized.
isLinearized
in interface IDocument
public void setLinearized(boolean value)
Sets a value indicating whether document is linearized.
setLinearized
in interface IDocument
value
- 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 IDocument
public boolean isEncrypted()
Gets encrypted status of the document. True if document is encrypted.
isEncrypted
in interface IDocument
public 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.
public 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.public void save(String outputFileName, int 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.SaveFormat
public void saveIncrementally(OutputStream output)
saveIncrementally
in interface IDocument
output
- OutputStream objectpublic void saveIncrementally(String outputFileName)
saveIncrementally
in interface IDocument
outputFileName
- OutputStream objectpublic void save(OutputStream outputStream, int format)
Saves the document with a new name along with a file format.
save
in interface IDocument
outputStream
- 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.SaveFormat
public void save(String outputFileName, SaveOptions options)
Saves the document with a new name setting its save options.
public void save(OutputStream outputStream, SaveOptions options)
Saves the document to a stream with a save options.
save
in interface IDocument
outputStream
- Stream where the document will be stored.options
- Save 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.public com.aspose.pdf.engine.data.types.IPdfStreamAccessor getMetadataStream()
Returns raw metadata stream
getMetadataStream
in interface IDocument
public void suppressUpdate()
Suppresses update contents data for all pages The contents is not updated until ResumeUpdate is called
suppressUpdate
in interface IDocument
public void resumeUpdate()
resumes document update
resumeUpdate
in interface IDocument
public void dispose()
Closes all resources used by this document.
public Color getBackground()
Gets the background color of the document.
getBackground
in interface IDocument
public void setBackground(Color value)
Sets the background color of the document.
setBackground
in interface IDocument
value
- Color objectpublic Copier getDefaultCopier()
Returns copier used for coping pages to this document.
getDefaultCopier
in interface IDocument
public 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 IDocument
public void optimizeResources(Document.OptimizationOptions strategy)
Optimize resources in the document according to defined optimization strategy.
strategy
- Optimization strategy.public 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.
getOptimizeSize
in interface IDocument
public 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.
setOptimizeSize
in interface IDocument
value
- boolean valuepublic 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.
getIgnoreCorruptedObjects
in interface IDocument
public void setIgnoreCorruptedObjects(boolean value)
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.
setIgnoreCorruptedObjects
in interface IDocument
value
- boolean valuepublic Object getCatalogValue(String key)
Returns item value from catalog dictionary.
getCatalogValue
in interface IDocument
key
- The key of item.public PageLabelCollection getPageLabels()
Gets page labels in the document.
getPageLabels
in interface IDocument
public void freeMemory()
Clears memory
freeMemory
in interface IDocument
public boolean isAbsentFontTryToSubstitute()
isAbsentFontTryToSubstitute
in interface IDocument
public void setAbsentFontTryToSubstitute(boolean setAbsentFontTryToSubstitute)
setAbsentFontTryToSubstitute
in interface IDocument
setAbsentFontTryToSubstitute
- boolean valuepublic boolean check(boolean doRepair)
public boolean isManualDisposeEnabled()
isManualDisposeEnabled
in interface IDocument
public void setManualDisposeEnabled(boolean manualDisposeEnabled)
setManualDisposeEnabled
in interface IDocument
manualDisposeEnabled
- boolean value. (Default value == false)public boolean isSkippedPdfaCompliantValidationBeforeSave()
public void setSkipPdfaCompliantValidationBeforeSave(boolean pdfaCompliantValidationBeforeSave)
pdfaCompliantValidationBeforeSave
- boolean valuepublic JavaScriptCollection getJavaScript()
Collection of JavaScript of document level.
public static boolean isLicensed()
Gets licensed state of the system. Returns true is system works in licensed mode and false otherwise.
public void setLayersAdded(boolean value)
IDocument
setLayersAdded
in interface IDocument
value
- boolean valuepublic static void startOperation()
public static void endOperation()
public boolean isPdfaCompliant()
Gets the is document pdfa compliant.
isPdfaCompliant
in interface IDocument
public boolean isPdfUaCompliant()
Gets the is document pdfua compliant.
isPdfUaCompliant
in interface IDocument
public boolean isXrefGapsAllowed()
Gets or sets the is document pdfa compliant.
isXrefGapsAllowed
in interface IDocument
public void setXrefGapsAllowed(boolean value)
Gets or sets the is document pdfa compliant.
setXrefGapsAllowed
in interface IDocument
value
- boolean valuepublic NamedDestinationCollection getNamedDestinations()
Collection of Named Destination in the document.
getNamedDestinations
in interface IDocument
public 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 IDocument
public 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 IDocument
value
- boolean valuepublic void removePdfUaCompliance()
Remove pdfUa compliance from the document
removePdfUaCompliance
in interface IDocument
public final void setTitle(String title)
Set Title for Pdf Document
public static void preSave(PageCollection pages, SaveOptions saveOptions)
pages
- PageCollection instancesaveOptions
- SaveOptions instancepublic final void setConvertMetadataAndCatalogOnly(boolean value)
Gets convert parameter for pdf/ua converter (Convert only Metadata and Document Catalog if set true)
setConvertMetadataAndCatalogOnly
in interface IDocument
value
- boolean valuepublic 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 void save(com.aspose.ms.System.IO.FileStream output)
public final void exportAnnotationsToXfdf(OutputStream output)
Export all document annotations into stream.
output
- Stream where store XFDF.public final void importAnnotationsFromXfdf(InputStream stream)
Imports annotations from stream to document.
stream
- Stream contains XFDF data.public final boolean convert(OutputStream outputLogStream, int format, int action, int 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 byte[] convertPageToPNGMemoryStream(Page page)
page
- Page objectpublic boolean validate(PdfFormatConversionOptions options)
Validate document into the specified file.
options
- set of options for convert PDF documentpublic boolean convert(Document.CallBackGetHocr callback, boolean isTestVisible)
This is allow to show/hide searchable text. Default value is FALSE.
public boolean convert(Document.CallBackGetHocr callback, boolean isTextVisible, boolean isOriginalImage)
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.
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(Form.FlattenSettings flattenSettings)
Removes all fields from the document and place their values instead.
flattenSettings
- Settings for flattening process.public void updatePages()
IDocument
updatePages
in interface IDocument
public void close()
Closes all resources used by this document.
public void optimizeResources(OptimizationOptions strategy)
Optimize resources in the document according to defined optimization strategy.
optimizeResources
in interface IDocument
strategy
- Optimization strategy.public 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 void afterImport()
Enumerate all registered annotations and call AfterImport for each of them. InternalMethod
afterImport
in interface IDocument
public 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 IDocument
id
- The object id.public void bindXml(InputStream stream)
Bind xml to document
public void bindXml(String file)
Bind xml to document
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 IDocument
output
- Stream where metadata will be stored.public void setXmpMetadata(InputStream stream)
Set XMP metadata of document.
setXmpMetadata
in interface IDocument
stream
- 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 perofmance.
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 perofmance.
value
- boolean valuepublic final 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");