Click or drag to resize

PdfDocument Class

Represents a root class in the GemBox.Pdf implementation of the PDF Document Structure as specified in the PDF Specification ISO 32000-1:2008, section '7.7 Document Structure'.
Inheritance Hierarchy

Namespace:  GemBox.Pdf
Assembly:  GemBox.Pdf (in GemBox.Pdf.dll) Version: 13.0.35.1000
Syntax
public sealed class PdfDocument : PdfObject, 
	IDisposable

The PdfDocument type exposes the following members.

Constructors
  NameDescription
Public methodPdfDocument
Initializes a new instance of the PDF document.
Top
Properties
  NameDescription
Public propertyId

(Required if an Encrypt entry is present in the file trailer; optional otherwise; PDF 1.1) An array of two byte-strings constituting a file identifier (see 14.4, "File Identifiers") for the file.

Because the Id entries are not encrypted it is possible to check the Id key to assure that the correct file is being accessed without decrypting the file.

Although this entry is optional, its absence might prevent the file from functioning in some workflows that depend on files being uniquely identified.

Public propertyInfo
(Optional; shall be an indirect reference) The document’s information dictionary (see 14.3.3, "Document Information Dictionary").
Public propertyOutlines
(Optional; shall be an indirect reference) The outline dictionary that shall be the root of the document’s outline hierarchy (see 12.3.3, "Document Outline").
Public propertyPageLayout

(Optional) Gets or sets the value specifying the page layout to be used when the document is opened.

Default value: SinglePage.

Public propertyPageMode

(Optional) Gets or sets the value specifying how the document shall be displayed when opened.

Default value: UseNone.

Public propertyPages
(Required; shall be an indirect reference) The page tree node that shall be the root of the document’s page tree (see 7.7.3, "Page Tree").
Public propertySaveOptions

Gets or sets the options used when saving the PdfDocument to a PDF file.

Default value: Default.

Public propertyVersion
(Optional; PDF 1.4) The version of the PDF specification to which the document conforms (for example, 1.4) if later than the version specified in the file’s header (see 7.5.2, "File Header"). If the header specifies a later version, or if this entry is absent, the document shall conform to the version specified in the header. This entry enables a conforming writer to update the version using an incremental update; see 7.5.6, "Incremental Updates".
Public propertyViewerPreferences
(Optional; PDF 1.2) A viewer preferences dictionary (see 12.2, "Viewer Preferences") specifying the way the document shall be displayed on the screen. If this entry is absent, conforming readers shall use their own current user preference settings.
Top
Methods
  NameDescription
Public methodClone

Makes a deep clone of this PdfDocument instance.

The clone and this PdfDocument do not share any objects, thus the cloned PdfDocument is a deep clone if this PdfDocument.

Public methodClose

Closes the PDF file associated with this PdfDocument.

Any PdfDocument that is associated with the PDF file should be closed, otherwise memory and resource leaks might occur because PDF file stream might not be closed until the application exists.

Public methodDispose

Closes the PDF file associated with this PdfDocument.

Any PdfDocument that is associated with the PDF file should be closed, otherwise memory and resource leaks might occur because PDF file stream might not be closed until the application exists.

Public methodLoad

Loads the PdfDocument entirely from the PDF file.

PDF file remains open. If you want to close the PDF file, use Close method.

Public methodStatic memberLoad(Stream)
Loads a PDF document from the specified stream and with the Default options.
Public methodStatic memberLoad(String)
Loads a PDF document from a file with the specified path and with the Default options.
Public methodStatic memberLoad(Stream, PdfLoadOptions)
Loads a PDF document from the specified stream and with the specified options.
Public methodStatic memberLoad(String, PdfLoadOptions)
Loads a PDF document from a file with the specified path and with the specified options.
Public methodSave

Save all the changes made to the current PDF document to the same location from where the PDF document was loaded or last saved.

This feature is also called incremental update.

Use SaveOptions to specify options used for saving the PdfDocument to a PDF file.

Public methodSave(Stream)

Saves the entire PDF document to the specified stream.

Use SaveOptions to specify options used for saving the PdfDocument to a PDF file.

Public methodSave(String)

Saves the entire PDF document to a file with the specified path.

Use SaveOptions to specify options used for saving the PdfDocument to a PDF file.

Public methodSetId
Sets the Id to a specified Guid value. Both Creation and Modification will be set to the specified Guid value.
Public methodToString
Returns a String that represents this PdfDocument instance.
(Overrides ObjectToString.)
Top
Extension Methods
  NameDescription
Public Extension MethodGetDictionary
Gets the PdfDictionary that serves as a backing storage of the specified PdfObject.
(Defined by PdfObjectExtensions.)
Top
See Also