Document Class
Class representing PDF document
Inheritance Hierarchy
SystemObject
  Aspose.PdfDocument

Namespace: Aspose.Pdf
Assembly: Aspose.PDF (in Aspose.PDF.dll) Version: 19.10
Syntax
public sealed class Document : IDisposable

The Document type exposes the following members.

Constructors
  NameDescription
Public methodDocument
Initializes empty document.
Public methodDocument(Stream)
Initialize new Document instance from the input stream.
Public methodDocument(String)
Just init Document using filename. The same as Document(Stream).
Public methodDocument(Stream, LoadOptions)
Opens an existing document from a stream providing necessary converting to get pdf document.
Public methodDocument(Stream, Boolean)
Initialize new Document instance from the input stream.
Public methodDocument(Stream, String)
Initialize new Document instance from the input stream.
Public methodDocument(String, LoadOptions)
Opens an existing document from a file providing necessary converting options to get pdf document.
Public methodDocument(String, String)
Initializes new instance of the Document class for working with encrypted document.
Public methodDocument(Stream, String, Boolean)
Initialize new Document instance from the input stream.
Public methodDocument(String, String, Boolean)
Initializes new instance of the Document class for working with encrypted document.
Properties
  NameDescription
Public propertyCode exampleActions
Gets document actions. This property is instance of DocumentActions class which allows to get/set BeforClosing, BeforSaving, etc. actions.
Public propertyAllowReusePageContent
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 propertyBackground
Gets or sets the background color of the document.
Public propertyCode exampleCenterWindow
Gets or sets flag specifying whether position of the document's window will be centerd on the screen.
Public propertyCollection
Gets collection of document.
Public propertyCryptoAlgorithm
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.
Public propertyDestinations
Gets the collection of destinations. Obsolete. Please use NamedDestinations.
Public propertyDirection
Gets or sets reading order of text: L2R (left to right) or R2L (right to left).
Public propertyCode exampleDisplayDocTitle
Gets or sets flag specifying whether document's window title bar should display document title.
Public propertyDuplex
Gets or sets print duplex mode handling option to use when printing the file from the print dialog.
Public propertyEmbeddedFiles
Gets collection of files embedded to document.
Public propertyEmbedStandardFonts
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.
Public propertyEnableObjectUnload
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 propertyFileName
Name of the PDF file that caused this document
Public propertyCode exampleFitWindow
Gets or sets flag specifying whether document window must be resized to fit the first displayed page.
Public propertyFontUtilities
IDocumentFontUtilities instance
Public propertyForm
Gets Acro Form of the document.
Public propertyCode exampleHideMenubar
Gets or sets flag specifying whether menu bar should be hidden when document is active.
Public propertyCode exampleHideToolBar
Gets or sets flag specifying whether toolbar should be hidden when document is active.
Public propertyCode exampleHideWindowUI
Gets or sets flag specifying whether user interface elements should be hidden when document is active.
Public propertyId
Gets the ID.
Public propertyIgnoreCorruptedObjects
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.
Public propertyInfo
Gets document info.
Public propertyIsEncrypted
Gets encrypted status of the document. True if document is encrypted.
Public propertyStatic memberIsLicensed
Gets licensed state of the system. Returns true is system works in licensed mode and false otherwise.
Public propertyIsLinearized
Gets or sets a value indicating whether document is linearized.
Public propertyIsPdfaCompliant
Gets the is document pdfa compliant.
Public propertyIsPdfUaCompliant
Gets the is document pdfua compliant.
Public propertyIsXrefGapsAllowed
Gets or sets the is document pdfa compliant.
Public propertyJavaScript
Collection of JavaScript of document level.
Public propertyLogicalStructure
Gets logical structure of the document.
Public propertyMetadata
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.)
Public propertyNamedDestinations
Collection of Named Destination in the document.
Public propertyNonFullScreenPageMode
Gets or sets page mode, specifying how to display the document on exiting full-screen mode.
Public propertyCode exampleOpenAction
Gets or sets action performed at document opening.
Public propertyOptimizeSize
Gets or 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.
Public propertyOutlines
Gets document outlines.
Public propertyPageInfo
Gets or sets the page info.(for generator only)
Public propertyPageLabels
Gets page labels in the document.
Public propertyPageLayout
Gets or sets page layout which shall be used when the document is opened.
Public propertyPageMode
Gets or sets page mode, specifying how document should be displayed when opened.
Public propertyCode examplePages
Gets or sets collection of document pages. Note that pages are numbered from 1 in collection.
Public propertyPdfFormat
Gets PDF format
Public propertyPermissions
Gets permissions of the document.
Public propertyCode exampleTaggedContent

Gets access to TaggedPdf content.

Public propertyVersion
Gets a version of Pdf from Pdf file header.
Methods
  NameDescription
Public methodBindXml(Stream)
Bind xml to document
Public methodBindXml(String)
Bind xml to document
Public methodBindXml(Stream, Stream)
Bind xml/xsl to document
Public methodBindXml(String, String)
Bind xml/xsl to document
Public methodBindXml(Stream, Stream, XmlReaderSettings)
Bind xml/xsl to document
Public methodChangePasswords
Changes document passwords. This action can be done only using owner password.
Public methodCheck
Validates document.
Public methodConvert(DocumentCallBackGetHocr)
Convert document and save errors into the specified file.
Public methodConvert(PdfFormatConversionOptions)
Convert document using specified conversion options
Public methodConvert(Stream, PdfFormat, ConvertErrorAction)
Convert document and save errors into the specified stream.
Public methodConvert(String, PdfFormat, ConvertErrorAction)
Convert document and save errors into the specified file.
Public methodStatic memberConvert(Stream, LoadOptions, Stream, SaveOptions)
Converts stream in source format into stream in destination format.
Public methodStatic memberConvert(Stream, LoadOptions, String, SaveOptions)
Converts stream in source format into destination file in destination format.
Public methodConvert(Stream, PdfFormat, ConvertErrorAction, ConvertTransparencyAction)
Convert document and save errors into the specified file.
Public methodStatic memberConvert(String, LoadOptions, Stream, SaveOptions)
Converts source file in source format into stream in destination format.
Public methodStatic memberConvert(String, LoadOptions, String, SaveOptions)
Converts source file in source format into destination file in destination format.
Public methodConvert(String, PdfFormat, ConvertErrorAction, ConvertTransparencyAction)
Convert document and save errors into the specified file.
Public methodConvertPageToPNGMemoryStream
Convert page to PNG for DSR, OMR , OCR
Public methodDecrypt
Decrypts the document. Call then Save to obtain decrypted version of the document.
Public methodDispose
Closes all resources used by this document.
Public methodEncrypt(String, String, Permissions, CryptoAlgorithm)
Encrypts the document. Call then Save to get encrypted version of the document.
Public methodEncrypt(String, String, DocumentPrivilege, CryptoAlgorithm, Boolean)
Encrypts the document. Call then Save to get encrypted version of the document.
Public methodEncrypt(String, String, Permissions, CryptoAlgorithm, Boolean)
Encrypts the document. Call then Save to get encrypted version of the document.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodExportAnnotationsToXfdf(Stream)
Export all document annotations into stream.
Public methodExportAnnotationsToXfdf(String)
Exports all document annotations to XFDF file
Public methodFlatten
Removes all fields from the document and place their values instead.
Public methodFlatten(FormFlattenSettings)
Removes all fields from the document and place their values instead.
Public methodFreeMemory
Clears memory
Public methodGetCatalogValue
Returns item value from catalog dictionary.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetObjectById
Gets a object with specified ID in the document.
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodGetXmpMetadata
Get XMP metadata from document.
Public methodImportAnnotationsFromXfdf(Stream)
Imports annotations from stream to document.
Public methodImportAnnotationsFromXfdf(String)
Imports annotations from XFDF file to document.
Public methodOptimize
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 methodOptimizeResources
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.
Public methodOptimizeResources(OptimizationOptions)
Optimize resources in the document according to defined optimization strategy.
Public methodProcessParagraphs
Process paragraphs for generator.
Public methodRemoveMetadata
Removes metadata from the document.
Public methodRemovePdfaCompliance
Remove pdfa compliance from the document
Public methodRemovePdfUaCompliance
Remove pdfUa compliance from the document
Public methodRepair
Repairs broken document.
Public methodSave
Save document incrementally (i.e. using incremental update technque).
Public methodSave(Stream)
Stores document into stream.
Public methodSave(String)
Saves document into the specified file.
Public methodSave(Stream, SaveFormat)
Saves the document with a new name along with a file format.
Public methodSave(Stream, SaveOptions)
Saves the document to a stream with a save options.
Public methodSave(String, SaveFormat)
Saves the document with a new name along with a file format.
Public methodSave(String, SaveOptions)
Saves the document with a new name setting its save options.
Public methodSave(HttpResponse, String, ContentDisposition, SaveOptions)
Saves the document to a response stream with a save options.
Public methodSaveXml
Save document to XML.
Public methodSendTo(DocumentDevice, Stream)
Sends the whole document to the document device for processing.
Public methodSendTo(DocumentDevice, String)
Sends the whole document to the document device for processing.
Public methodSendTo(DocumentDevice, Int32, Int32, Stream)
Sends the certain pages of the document to the document device for processing.
Public methodSendTo(DocumentDevice, Int32, Int32, String)
Sends the whole document to the document device for processing.
Public methodSetTitle
Set Title for Pdf Document
Public methodSetXmpMetadata
Set XMP metadata of document.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodValidate(PdfFormatConversionOptions)
Validate document into the specified file.
Public methodValidate(Stream, PdfFormat)
Validate document into the specified file.
Public methodValidate(String, PdfFormat)
Validate document into the specified file.
Events
  NameDescription
Public eventFontSubstitution
Occurs when font replaces another font in document.
See Also