Table of Contents

Class PdfDocument

Namespace
BitMiracle.Docotic.Pdf
Assembly
BitMiracle.Docotic.Pdf.dll

Class for PDF document processing. This class can be used to create, read, merge or compare files in Portable Document Format.

public sealed class PdfDocument : IDisposable
Inheritance
PdfDocument
Implements
Inherited Members

Constructors

PdfDocument()

Creates a new blank PDF document.

PdfDocument(PdfConfigurationOptions)

Creates a new blank PDF document using specified configuration options.

PdfDocument(byte[])

Opens an existing PDF document.

PdfDocument(Stream)

Opens an existing PDF document.

PdfDocument(Stream, PdfConfigurationOptions)

Opens an existing PDF document using specified configuration options.

PdfDocument(Stream, PdfDecryptionHandler)

Opens an existing encrypted PDF document.

PdfDocument(Stream, PdfDecryptionHandler, PdfConfigurationOptions)

Opens an existing encrypted PDF document using specified configuration options.

PdfDocument(string)

Opens an existing PDF document.

PdfDocument(string, PdfConfigurationOptions)

Opens an existing PDF document using specified configuration options.

PdfDocument(string, PdfDecryptionHandler)

Opens an existing encrypted PDF document.

PdfDocument(string, PdfDecryptionHandler, PdfConfigurationOptions)

Opens an existing encrypted PDF document using specified configuration options.

Properties

AutoCreateUriActions

Gets or sets a value indicating whether to check each text string drawn with DrawString or DrawText(string, PdfTextDrawingOptions) for URIs and create PdfUriActions for each found URI.

GrantedPermissions

Gets the permissions granted for the current document.

HasSignaturePermissions

Gets a value indicating whether this document has digital signature permissions.

Info

Gets the interface for the document metadata.

InitialView

Gets or sets the PdfDocumentView to open when the document is opened.

IsLinearized

Gets a value indicating whether this document is linearized (optimized for fast viewing on the web).

Layers

Gets the collection of layers (also known as optional content groups) in this document.

Metadata

Gets the XMP metadata attached to the document.

NeedAppearances

Gets or sets a value indicating whether the viewing application should construct appearances of all controls and widgets in this document.

OnOpenDocument

Gets or sets the action to be performed when the document is opened.

OutlineRoot

Gets the document outline root.

PageCount

Gets the number of pages in this document.

PageLabels

Gets the collection of page labeling ranges in this document.

PageLayout

Gets or sets the page layout to be used when the document is opened by a PDF viewer application.

PageMode

Gets or sets how the document should be displayed when opened by a PDF viewer application.

Pages

Gets the collection of pages in this document.

SharedAttachments

Gets the collection of document-level attachments.

SharedScripts

Gets the collection of shared JavaScript actions in this document.

UsesObjectStreams

Gets a value indicating whether this document uses object streams to store internal structures more compactly.

Version

Gets the version of the PDF specification to which this document conforms.

ViewerPreferences

Gets the interface for the viewer preferences of this document.

Xfa

Gets or sets the XFA form attached to the document.

Methods

AddColorProfile(byte[])

Adds a new ICC color profile to the end of the collection of document color profiles.

AddColorProfile(Stream)

Adds a new ICC color profile read from specified stream to the end of the collection of document color profiles.

AddColorProfile(string)

Adds a new ICC color profile read from file with specified name to the end of the collection of document color profiles.

AddColoredPattern(double, double)

Adds a new colored tiling pattern to the end of the collection of document patterns.

AddFont(PdfBuiltInFont)

Adds a new instance of built-in font to the end of the collection of document fonts.

AddFont(PdfBuiltInFont, bool, bool)

Adds a new instance of built-in font with specified properties to the end of the collection of document fonts.

AddFont(byte[])

Creates a new font using provided font bytes and adds the new font to the end of the collection of document fonts.

AddFont(byte[], bool, bool)

Creates a new font with specified properties using provided font bytes and adds the new font to the end of the collection of document fonts.

AddFont(byte[], bool, bool, bool, bool)

Creates a new font with specified properties using provided font bytes and adds the new font to the end of the collection of document fonts.

AddFont(Stream)

Creates a new font using provided stream with font bytes and adds the new font to the end of the collection of document fonts.

AddFont(Stream, bool, bool)

Creates a new font with specified properties using provided stream with font bytes and adds the new font to the end of the collection of document fonts.

AddFont(Stream, bool, bool, bool, bool)

Creates a new font with specified properties using provided stream with font bytes and adds the new font to the end of the collection of document fonts.

AddFont(string)

Adds a new font with specified face name to the end of the collection of document fonts.

AddFont(string, bool, bool, bool, bool)

Adds a new font with specified properties to the end of the collection of document fonts.

AddFontFromFile(string)

Creates a new font using provided font file and adds the new font to the end of the collection of document fonts.

AddFontFromFile(string, bool, bool)

Creates a new font with specified properties using provided font file and adds the new font to the end of the collection of document fonts.

AddFontFromFile(string, bool, bool, bool, bool)

Creates a new font with specified properties using provided font file and adds the new font to the end of the collection of document fonts.

AddImage(PdfImageFrame)

Creates a new image from specified PdfImageFrame and adds it to the end of the collection of document images.

AddImage(byte[])

Adds new image(s) with the data and properties read from the buffer with image bytes to the end of the collection of document images.

AddImage(byte[], PdfColor?)

Creates image(s) with the data and properties read from the buffer with image bytes, applies specified mask color to them and adds resulting image(s) to the end of the collection of document images.

AddImage(byte[], byte[])

Creates a new image with the data and properties read from the buffer with image bytes, applies mask constructed from the buffer with mask image bytes to it and adds resulting image to the end of the collection of document images.

AddImage(Stream)

Adds new image(s) with the data and properties read from the specified stream to the end of the collection of document images.

AddImage(Stream, PdfColor)

Creates image(s) with the data and properties read from the specified stream, applies specified mask color to them and adds resulting image(s) to the end of the collection of document images.

AddImage(Stream, Stream)

Creates a new image with the data and properties read from the specified stream, applies mask read from another stream to it and adds resulting image to the end of the collection of document images.

AddImage(string)

Adds new image(s) with the data and properties read from the file with specified name to the end of the collection of document images.

AddImage(string, PdfColor)

Creates image(s) with the data and properties read from the file with specified name, applies specified mask color to them and adds resulting image(s) to the end of the collection of document images.

AddImage(string, string)

Creates a new image with the data and properties read from the file with specified name, applies mask read from another file with specified name to it and adds resulting image to the end of the collection of document images.

AddPage()

Adds new page to the end of the collection of document pages.

AddUncoloredPattern(double, double, PdfColorSpace)

Adds a new uncolored tiling pattern with specified underlying color space to the end of the collection of document patterns.

Append(byte[])

Appends the contents of specified buffer with PDF data to this PdfDocument.

Append(Stream)

Appends the contents of specified stream with PDF data to this PdfDocument.

Append(Stream, PdfDecryptionHandler)

Appends the contents of the specified stream with PDF data to this PdfDocument.

Append(Stream, PdfDecryptionHandler, PdfMergingOptions)

Appends the contents of the specified stream with PDF data to this PdfDocument.

Append(string)

Appends the contents of existing PDF file with the specified name to this PdfDocument.

Append(string, PdfDecryptionHandler)

Appends the contents of existing PDF file with the specified name to this PdfDocument.

Append(string, PdfDecryptionHandler, PdfMergingOptions)

Appends the contents of an existing PDF file with the specified name to this PdfDocument.

ContainsTransparencyGroups()

Checks if there are any objects with transparency groups in this document.

CopyPages(PdfPage[])

Copies specified pages into new PdfDocument. This PdfDocument remains unchanged.

CopyPages(int, int)

Copies a range of pages into new PdfDocument. This PdfDocument remains unchanged.

CopyPages(int, int, PdfConfigurationOptions)

Copies a range of pages into new PdfDocument using specified configuration options. This PdfDocument remains unchanged.

CopyPages(int[])

Copies pages with specified indexes into new PdfDocument.

Create3dView(string)

Creates a 3D view object.

CreateFileAttachment(byte[], string)

Creates attachment from provided bytes and returns file specification for the attachment.

CreateFileAttachment(byte[], string, string?)

Creates attachment from provided bytes and returns file specification for the attachment.

CreateFileAttachment(Stream, string)

Creates attachment from contents of provided stream and returns file specification for the attachment.

CreateFileAttachment(Stream, string, string?)

Creates attachment from contents of provided stream and returns file specification for the attachment.

CreateFileAttachment(string)

Creates attachment from the specified file and returns file specification for the attachment.

CreateFileAttachment(string, string?)

Creates attachment from the specified file and returns file specification for the attachment.

CreateGoToPageAction(PdfPage, double)

Creates a new PdfGoToAction with specified properties.

CreateGoToPageAction(int, double)

Creates a new PdfGoToAction with specified properties.

CreateHideAction(bool)

Creates a new PdfHideAction.

CreateHyperlinkAction(string)

Creates a new PdfUriAction with specified uniform resource identifier (URI) to resolve.

CreateHyperlinkAction(Uri)

Creates a new PdfUriAction with specified uniform resource identifier (URI) to resolve.

CreateImportDataAction(string)

Creates a new PdfImportDataAction.

CreateJavaScriptAction(string)

Creates a new PdfJavaScriptAction with specified script contents.

CreateLaunchAction(string)

Creates a new PdfLaunchAction.

CreateLayer(string)

Creates a new PdfLayer with specified name and adds it to the collection of documents layers.

CreateLayer(string, bool, params PdfLayerIntent[])

Creates a new PdfLayer with specified name and properties and adds it to the collection of documents layers.

CreateRemoteGoToPageAction(string, int)

Creates a new PdfRemoteGoToAction with specified properties.

CreateResetFormAction()

Creates a new PdfResetFormAction.

CreateSubmitFormAction(Uri)

Creates a new PdfSubmitFormAction with specified properties.

CreateSubmitFormAction(Uri, bool)

Creates a new PdfSubmitFormAction with specified properties.

CreateSubmitFormAction(Uri, bool, PdfSubmitFormat)

Creates a new PdfSubmitFormAction with specified properties.

CreateView(PdfPage)

Creates a new PdfDocumentView for specified page and adds it to the collection of document views.

CreateView(int)

Creates a new PdfDocumentView for specified page and adds it to the collection of document views.

CreateXObject()

Creates a new XObject that can be used with one of the DrawXObject methods.

CreateXObject(PdfPage)

Creates a new XObject using a page as template. The created XObject can be used with one of the DrawXObject methods.

CreateXfaForm(Stream)

Creates an XFA form from the specified stream.

CreateXfaForm(string)

Creates an XFA form from the specified stream.

Dispose()

Frees and releases all resources allocated by this PdfDocument.

DocumentsAreEqual(Stream, Stream)

Compares the data and structure of two not encrypted PDF documents.

DocumentsAreEqual(Stream, Stream, PdfDecryptionHandler)

Compares the data and structure of two PDF documents.

DocumentsAreEqual(Stream, Stream, PdfDecryptionHandler, PdfConfigurationOptions)

Compares the data and structure of two PDF documents.

DocumentsAreEqual(string, string)

Compares the data and structure of two not encrypted PDF documents.

DocumentsAreEqual(string, string, PdfDecryptionHandler)

Compares the data and structure of two PDF documents.

ExportFdf(Stream)

Takes the values from the controls in this PdfDocument and exports them into FDF document.

ExportFdf(string)

Takes the values from the controls in this PdfDocument and exports them into FDF document.

ExtractPages(PdfPage[])

Extracts specified pages into new PdfDocument.

ExtractPages(int, int)

Extracts a range of pages into new PdfDocument.

ExtractPages(int, int, PdfConfigurationOptions)

Extracts a range of pages into new PdfDocument using specified configuration options.

ExtractPages(int[])

Extracts pages with specified indexes into new PdfDocument.

FlattenControls()

Flattens all controls in the document. In effect, replaces controls with their appearance. Putting it differently, merges controls down on to their respective pages.

FlattenWidgets()

Flattens all widgets in the document. In effect, replaces widgets with their appearance. Putting it differently, merges widgets down on to their respective pages.

GetActions()

Returns the enumerator that iterates through the collection of actions in this document.

GetColorProfiles()

Returns the enumerator that iterates through the collection of color profiles in this document.

GetControl(string)

Gets the control by name.

GetControls()

Returns the enumerator that iterates through the collection of document controls.

GetEncryptionInfo(Stream)

Retrieves information about encryption scheme used in a PDF document.

GetEncryptionInfo(Stream, PdfConfigurationOptions)

Retrieves information about encryption scheme used in a PDF document.

GetEncryptionInfo(string)

Retrieves information about encryption scheme used in a PDF document.

GetEncryptionInfo(string, PdfConfigurationOptions)

Retrieves information about encryption scheme used in a PDF document.

GetFonts()

Returns the enumerator that iterates through the collection of document fonts.

GetImages()

Returns the enumerator that iterates through the collection of document images including inline images and images added to document but not yet drawn on any canvas.

GetImages(bool)

Returns the enumerator that iterates through the collection of document images including or excluding the inline images. The enumerator includes images added to document but not yet drawn on any canvas.

GetPage(int)

Gets the page with the specified index.

GetPatterns()

Returns the enumerator that iterates through the collection of patterns in this document.

GetPdfaConformance()

Gets PDF/A standard conformance level for this PdfDocument.

GetPdfxConformance()

Gets PDF/X standard conformance level for this PdfDocument.

GetText()

Retrieves all text drawn on all pages of the document in plain text format.

GetText(PdfTextExtractionOptions)

Retrieves all text drawn on all pages of the document according to the specified options.

GetTextWithFormatting()

Retrieves all text drawn on all pages of the document formatted as seen in a PDF viewer.

GetViews()

Returns the enumerator that iterates through the collection of document views added to this document.

GetWidgets()

Returns the enumerator that iterates through the collection of document widgets (annotations and controls).

ImportFdf(byte[])

Takes the values from the FDF document and imports them into this PdfDocument.

ImportFdf(Stream)

Takes the values from the FDF document and import them into this PdfDocument.

ImportFdf(string)

Takes the values from the FDF document and imports them into this PdfDocument.

IndexOf(PdfPage)

Gets the index of page in the document page collection.

InsertPage(int)

Inserts new page into the collection of document pages at the specified index.

MovePage(int, int)

Changes position of the page within the collection of document pages.

MovePages(int, int, int)

Changes positions of all pages in specified range within the collection of document pages.

MovePages(int[], int)

Changes positions of all pages specified by their indexes within the collection of document pages.

OpenImage(byte[])

Opens the image and constructs a collection of its frames (pages).

OpenImage(Stream)

Opens the image and constructs a collection of its frames (pages).

OpenImage(string)

Opens the image and constructs a collection of its frames (pages).

RemovePage(PdfPage)

Removes the specified page from the collection of document pages.

RemovePage(int)

Removes the page at the specified index of the collection of document pages.

RemovePages(PdfPage[])

Removes specified pages from the collection of document pages.

RemovePages(int)

Removes a range of pages from the collection of document pages.

RemovePages(int, int)

Removes a range of pages from the collection of document pages.

RemovePages(int[])

Removes pages with specified indexes from the collection of document pages.

RemovePieceInfo()

Removes all page-piece dictionaries from the document.

RemoveSignaturePermissions()

Removes all digital signature permissions from the PDF document.

RemoveStructureInformation()

Removes all structure information from the PDF document.

RemoveTransparencyGroups()

Removes all transparency groups from the PDF document.

RemoveUnusedFontGlyphs()

Tries to remove unused glyphs from all fonts in the document.

RemoveUnusedFontGlyphs(IEnumerable<PdfFont>)

Tries to remove unused glyphs from the specified fonts in the document.

RemoveUnusedResources()

Removes references to resources such as fonts, xobjects, images, patterns.

RemoveWidget(PdfWidget)

Removes the specified widget from the document.

RemoveXfa()

Removes an XFA form attached to this document.

ReplaceDuplicateObjects()

Replaces duplicate document objects with the first duplicate.

ReplaceDuplicateObjects(PdfDuplicateObjectKinds)

Replaces duplicate document objects with the first duplicate.

Save(Stream)

Saves the document to the specified stream.

Save(Stream, PdfSaveOptions)

Saves the document using the specified save options to the specified stream.

Save(string)

Saves the document to the file with the specified name.

Save(string, PdfSaveOptions)

Saves the document using the specified save options to the file with the specified name.

SaveAsTiff(Stream, PdfDrawOptions)

Creates images of each page in the document, then creates a multipage TIFF from the images and saves the TIFF to the specified stream.

SaveAsTiff(string, PdfDrawOptions)

Creates images of each page in the document, then creates a multipage TIFF from the images and saves the TIFF to the file with specified name.

SetPdfAOutputIntent(PdfColorProfile)

Sets the PDF/A output intent for this document.

SetPdfXOutputIntent(PdfColorProfile)

Sets the PDF/X output intent for this document.

SignAndSave(PdfSigningOptions, Stream)

Digitally signs the document using the specified signing options. Then saves the document to the specified stream.

SignAndSave(PdfSigningOptions, Stream, PdfSaveOptions)

Digitally signs the document using the specified signing and save options. Then saves the document to the specified stream.

SignAndSave(PdfSigningOptions, string)

Digitally signs the document using the specified signing options. Then saves the document to the file with the specified name.

SignAndSave(PdfSigningOptions, string, PdfSaveOptions)

Digitally signs the document using the specified signing and save options. Then saves the document to the file with the specified name.

SwapPages(int, int)

Interchanges positions of two pages.

SyncMetadata(bool)

Synchronizes values in XMP Metadata and Document Info.