PdfDocument Class

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

Inheritance Hierarchy

System.Object
  BitMiracle.Docotic.Pdf.PdfDocument

Namespace:  BitMiracle.Docotic.Pdf
Assembly:  BitMiracle.Docotic.Pdf (in BitMiracle.Docotic.Pdf.dll)

Syntax

C#
public sealed class PdfDocument : IDisposable
VB
Public NotInheritable Class PdfDocument
	Implements IDisposable

The PdfDocument type exposes the following members.

Constructors

  NameDescription
Public methodPdfDocument()
Creates a new blank PDF document.
Public methodPdfDocument(Byte[])
Opens an existing PDF document.
Public methodPdfDocument(PdfConfigurationOptions)
Creates a new blank PDF document using specified configuration options.
Public methodPdfDocument(Stream)
Opens an existing PDF document.
Public methodPdfDocument(String)
Opens an existing PDF document.
Public methodPdfDocument(Stream, PdfConfigurationOptions)
Opens an existing PDF document using specified configuration options.
Public methodPdfDocument(Stream, PdfDecryptionHandler)
Opens an existing encrypted PDF document.
Public methodPdfDocument(String, PdfConfigurationOptions)
Opens an existing PDF document using specified configuration options.
Public methodPdfDocument(String, PdfDecryptionHandler)
Opens an existing encrypted PDF document.
Public methodPdfDocument(Stream, PdfDecryptionHandler, PdfConfigurationOptions)
Opens an existing encrypted PDF document using specified configuration options.
Public methodPdfDocument(String, PdfDecryptionHandler, PdfConfigurationOptions)
Opens an existing encrypted PDF document using specified configuration options.

Properties

  NameDescription
Public propertyAutoCreateUriActions
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.
Public propertyGrantedPermissions
Gets the permissions granted for the current document.
Public propertyHasSignaturePermissions
Gets a value indicating whether this document has digital signature permissions.
Public propertyInfo
Gets the interface for the document metadata.
Public propertyInitialView
Gets or sets the PdfDocumentView to open when the document is opened.
Public propertyIsLinearized
Gets a value indicating whether this document is linearized (optimized for fast viewing on the web).
Public propertyLayers
Gets the collection of layers (also known as optional content groups) in this document.
Public propertyMetadata
Gets the XMP metadata attached to the document.
Public propertyNeedAppearances
Gets or sets a value indicating whether the viewing application should construct appearances of all controls and widgets in this document.
Public propertyOnOpenDocument
Gets or sets the action to be performed when the document is opened.
Public propertyOutlineRoot
Gets the document outline root.
Public propertyPageCount
Gets the number of pages in this document.
Public propertyPageLabels
Gets the collection of page labeling ranges in this document.
Public propertyPageLayout
Gets or sets the page layout to be used when the document is opened by a PDF viewer application.
Public propertyPageMode
Gets or sets how the document should be displayed when opened by a PDF viewer application.
Public propertyPages
Gets the collection of pages in this document.
Public propertySharedAttachments
Gets the collection of document-level attachments.
Public propertySharedScripts
Gets the collection of shared JavaScript actions in this document.
Public propertyUsesObjectStreams
Gets a value indicating whether this document uses object streams to store internal structures more compactly.
Public propertyVersion
Gets the version of the PDF specification to which this document conforms.
Public propertyViewerPreferences
Gets the interface for the viewer preferences of this document.

Methods

  NameDescription
Public methodAddColoredPattern
Adds a new colored tiling pattern to the end of the collection of document patterns.
Public methodAddColorProfile(Byte[])
Adds a new ICC color profile to the end of the collection of document color profiles.
Public methodAddColorProfile(Stream)
Adds a new ICC color profile read from specified stream to the end of the collection of document color profiles.
Public methodAddColorProfile(String)
Adds a new ICC color profile read from file with specified name to the end of the collection of document color profiles.
Public methodAddFont(Byte[])
Creates a new font using provided font bytes and adds the new font to the end of the collection of document fonts.
Public methodAddFont(PdfBuiltInFont)
Adds a new instance of built-in font to the end of the collection of document fonts.
Public methodAddFont(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.
Public methodAddFont(String)
Adds a new font with specified face name to the end of the collection of document fonts.
Public methodAddFont(Byte[], Boolean, Boolean)
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.
Public methodAddFont(PdfBuiltInFont, Boolean, Boolean)
Adds a new instance of built-in font with specified properties to the end of the collection of document fonts.
Public methodAddFont(Stream, Boolean, Boolean)
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.
Public methodAddFont(Byte[], Boolean, Boolean, Boolean, Boolean)
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.
Public methodAddFont(Stream, Boolean, Boolean, Boolean, Boolean)
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.
Public methodAddFont(String, Boolean, Boolean, Boolean, Boolean)
Adds a new font with specified properties to the end of the collection of document fonts.
Public methodAddFontFromFile(String)
Creates a new font using provided font file and adds the new font to the end of the collection of document fonts.
Public methodAddFontFromFile(String, Boolean, Boolean)
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.
Public methodAddFontFromFile(String, Boolean, Boolean, Boolean, Boolean)
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.
Public methodAddImage(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.
Public methodAddImage(PdfImageFrame)
Creates a new image from specified PdfImageFrame and adds it to the end of the collection of document images.
Public methodAddImage(Stream)
Adds new image(s) with the data and properties read from the specified stream to the end of the collection of document images.
Public methodAddImage(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.
Public methodAddImage(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.
Public methodAddImage(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.
Public methodAddImage(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.
Public methodAddImage(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.
Public methodAddImage(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.
Public methodAddImage(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.
Public methodAddPage
Adds new page to the end of the collection of document pages.
Public methodAddUncoloredPattern
Adds a new uncolored tiling pattern with specified underlying color space to the end of the collection of document patterns.
Public methodAppend(Byte[])
Appends the contents of specified buffer with PDF data to this PdfDocument.
Public methodAppend(Stream)
Appends the contents of specified stream with PDF data to this PdfDocument.
Public methodAppend(String)
Appends the contents of existing PDF file with the specified name to this PdfDocument.
Public methodAppend(Stream, PdfDecryptionHandler)
Appends the contents of the specified stream with PDF data to this PdfDocument.
Public methodAppend(String, PdfDecryptionHandler)
Appends the contents of existing PDF file with the specified name to this PdfDocument.
Public methodAppend(Stream, PdfDecryptionHandler, PdfMergingOptions)
Appends the contents of the specified stream with PDF data to this PdfDocument.
Public methodAppend(String, PdfDecryptionHandler, PdfMergingOptions)
Appends the contents of an existing PDF file with the specified name to this PdfDocument.
Public methodContainsTransparencyGroups
Checks if there are any objects with transparency groups in this document.
Public methodCopyPages(Int32[])
Copies pages with specified indexes into new PdfDocument.
Public methodCopyPages(PdfPage[])
Copies specified pages into new PdfDocument. This PdfDocument remains unchanged.
Public methodCopyPages(Int32, Int32)
Copies a range of pages into new PdfDocument. This PdfDocument remains unchanged.
Public methodCopyPages(Int32, Int32, PdfConfigurationOptions)
Copies a range of pages into new PdfDocument using specified configuration options. This PdfDocument remains unchanged.
Public methodCreate3dView
Creates a 3D view object.
Public methodCreateFileAttachment(String)
Creates attachment from the specified file and returns file specification for the attachment.
Public methodCreateFileAttachment(Byte[], String)
Creates attachment from provided bytes and returns file specification for the attachment.
Public methodCreateFileAttachment(Stream, String)
Creates attachment from contents of provided stream and returns file specification for the attachment.
Public methodCreateFileAttachment(String, String)
Creates attachment from the specified file and returns file specification for the attachment.
Public methodCreateFileAttachment(Byte[], String, String)
Creates attachment from provided bytes and returns file specification for the attachment.
Public methodCreateFileAttachment(Stream, String, String)
Creates attachment from contents of provided stream and returns file specification for the attachment.
Public methodCreateGoToPageAction(Int32, Double)
Creates a new PdfGoToAction with specified properties.
Public methodCreateGoToPageAction(PdfPage, Double)
Creates a new PdfGoToAction with specified properties.
Public methodCreateHideAction
Creates a new PdfHideAction.
Public methodCreateHyperlinkAction(String)
Creates a new PdfUriAction with specified uniform resource identifier (URI) to resolve.
Public methodCreateHyperlinkAction(Uri)
Creates a new PdfUriAction with specified uniform resource identifier (URI) to resolve.
Public methodCreateImportDataAction
Creates a new PdfImportDataAction.
Public methodCreateJavaScriptAction
Creates a new PdfJavaScriptAction with specified script contents.
Public methodCreateLaunchAction
Creates a new PdfLaunchAction.
Public methodCreateLayer(String)
Creates a new PdfLayer with specified name and adds it to the collection of documents layers.
Public methodCreateLayer(String, Boolean, PdfLayerIntent[])
Creates a new PdfLayer with specified name and properties and adds it to the collection of documents layers.
Public methodCreateRemoteGoToPageAction
Creates a new PdfRemoteGoToAction with specified properties.
Public methodCreateResetFormAction
Creates a new PdfResetFormAction.
Public methodCreateSubmitFormAction(Uri)
Creates a new PdfSubmitFormAction with specified properties.
Public methodCreateSubmitFormAction(Uri, Boolean)
Creates a new PdfSubmitFormAction with specified properties.
Public methodCreateSubmitFormAction(Uri, Boolean, PdfSubmitFormat)
Creates a new PdfSubmitFormAction with specified properties.
Public methodCreateView(Int32)
Creates a new PdfDocumentView for specified page and adds it to the collection of document views.
Public methodCreateView(PdfPage)
Creates a new PdfDocumentView for specified page and adds it to the collection of document views.
Public methodCreateXObject()
Creates a new XObject that can be used with one of the DrawXObject() methods.
Public methodCreateXObject(PdfPage)
Creates a new XObject using a page as template. The created XObject can be used with one of the DrawXObject() methods.
Public methodDispose
Frees and releases all resources allocated by this PdfDocument.
Public methodStatic memberDocumentsAreEqual(Stream, Stream)
Compares the data and structure of two not encrypted PDF documents.
Public methodStatic memberDocumentsAreEqual(String, String)
Compares the data and structure of two not encrypted PDF documents.
Public methodStatic memberDocumentsAreEqual(Stream, Stream, PdfDecryptionHandler)
Compares the data and structure of two PDF documents.
Public methodStatic memberDocumentsAreEqual(String, String, PdfDecryptionHandler)
Compares the data and structure of two PDF documents.
Public methodStatic memberDocumentsAreEqual(Stream, Stream, PdfDecryptionHandler, PdfConfigurationOptions)
Compares the data and structure of two PDF documents.
Public methodEquals (Inherited from Object.)
Public methodExportFdf(Stream)
Takes the values from the controls in this PdfDocument and exports them into FDF document.
Public methodExportFdf(String)
Takes the values from the controls in this PdfDocument and exports them into FDF document.
Public methodExtractPages(Int32[])
Extracts pages with specified indexes into new PdfDocument.
Public methodExtractPages(PdfPage[])
Extracts specified pages into new PdfDocument.
Public methodExtractPages(Int32, Int32)
Extracts a range of pages into new PdfDocument.
Public methodExtractPages(Int32, Int32, PdfConfigurationOptions)
Extracts a range of pages into new PdfDocument using specified configuration options.
Public methodFlattenControls
Flattens all controls in the document. In effect, replaces controls with their appearance. Putting it differently, merges controls down on to their respective pages.
Public methodGetActions
Returns the enumerator that iterates through the collection of actions in this document.
Public methodGetColorProfiles
Returns the enumerator that iterates through the collection of color profiles in this document.
Public methodGetControl
Gets the control by name.
Public methodGetControls
Returns the enumerator that iterates through the collection of document controls.
Public methodStatic memberGetEncryptionInfo(Stream)
Retrieves information about encryption scheme used in a PDF document.
Public methodStatic memberGetEncryptionInfo(String)
Retrieves information about encryption scheme used in a PDF document.
Public methodStatic memberGetEncryptionInfo(Stream, PdfConfigurationOptions)
Retrieves information about encryption scheme used in a PDF document.
Public methodStatic memberGetEncryptionInfo(String, PdfConfigurationOptions)
Retrieves information about encryption scheme used in a PDF document.
Public methodGetFonts
Returns the enumerator that iterates through the collection of document fonts.
Public methodGetHashCode (Inherited from Object.)
Public methodGetImages()
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.
Public methodGetImages(Boolean)
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.
Public methodGetPage
Gets the page with the specified index.
Public methodGetPatterns
Returns the enumerator that iterates through the collection of patterns in this document.
Public methodGetPdfaConformance
Gets PDF/A standard conformance level for this PdfDocument.
Public methodGetPdfxConformance
Gets PDF/X standard conformance level for this PdfDocument.
Public methodGetText()
Retrieves all text drawn on all pages of the document in plain text format.
Public methodGetText(PdfTextExtractionOptions)
Retrieves all text drawn on all pages of the document according to the specified options.
Public methodGetTextWithFormatting
Retrieves all text drawn on all pages of the document formatted as seen in a PDF viewer.
Public methodGetType (Inherited from Object.)
Public methodGetViews
Returns the enumerator that iterates through the collection of document views added to this document.
Public methodGetWidgets
Returns the enumerator that iterates through the collection of document widgets (annotations and controls).
Public methodImportFdf(Byte[])
Takes the values from the FDF document and imports them into this PdfDocument.
Public methodImportFdf(Stream)
Takes the values from the FDF document and import them into this PdfDocument.
Public methodImportFdf(String)
Takes the values from the FDF document and imports them into this PdfDocument.
Public methodIndexOf
Gets the index of page in the document page collection.
Public methodInsertPage
Inserts new page into the collection of document pages at the specified index.
Public methodMovePage
Changes position of the page within the collection of document pages.
Public methodMovePages(Int32[], Int32)
Changes positions of all pages specified by their indexes within the collection of document pages.
Public methodMovePages(Int32, Int32, Int32)
Changes positions of all pages in specified range within the collection of document pages.
Public methodOpenImage(Byte[])
Opens the image and constructs a collection of its frames (pages).
Public methodOpenImage(Stream)
Opens the image and constructs a collection of its frames (pages).
Public methodOpenImage(String)
Opens the image and constructs a collection of its frames (pages).
Public methodRemovePage(Int32)
Removes the page at the specified index of the collection of document pages.
Public methodRemovePage(PdfPage)
Removes the specified page from the collection of document pages.
Public methodRemovePages(Int32)
Removes a range of pages from the collection of document pages.
Public methodRemovePages(Int32[])
Removes pages with specified indexes from the collection of document pages.
Public methodRemovePages(PdfPage[])
Removes specified pages from the collection of document pages.
Public methodRemovePages(Int32, Int32)
Removes a range of pages from the collection of document pages.
Public methodRemovePieceInfo
Removes all page-piece dictionaries from the document.
Public methodRemoveSignaturePermissions
Removes all digital signature permissions from the PDF document.
Public methodRemoveStructureInformation
Removes all structure information from the PDF document.
Public methodRemoveTransparencyGroups
Removes all transparency groups from the PDF document.
Public methodRemoveUnusedFontGlyphs()
Tries to remove unused glyphs from all fonts in the document.
Public methodRemoveUnusedFontGlyphs(IEnumerable<PdfFont>)
Tries to remove unused glyphs from the specified fonts in the document.
Public methodRemoveUnusedResources
Removes references to resources such as fonts, xobjects, images, patterns.
Public methodRemoveWidget
Removes the specified widget from the document.
Public methodReplaceDuplicateObjects()
Replaces duplicate document objects with the first duplicate.
Public methodReplaceDuplicateObjects(PdfDuplicateObjectKinds)
Replaces duplicate document objects with the first duplicate.
Public methodSave(Stream)
Saves the document to the specified stream.
Public methodSave(String)
Saves the document to the file with the specified name.
Public methodSave(Stream, PdfSaveOptions)
Saves the document using the specified save options to the specified stream.
Public methodSave(String, PdfSaveOptions)
Saves the document using the specified save options to the file with the specified name.
Public methodSaveAsTiff(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.
Public methodSaveAsTiff(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.
Public methodSetPdfAOutputIntent
Sets the PDF/A output intent for this document.
Public methodSetPdfXOutputIntent
Sets the PDF/X output intent for this document.
Public methodSignAndSave(PdfSigningOptions, Stream)
Digitally signs the document using the specified signing options. Then saves the document to the specified stream.
Public methodSignAndSave(PdfSigningOptions, String)
Digitally signs the document using the specified signing options. Then saves the document to the file with the specified name.
Public methodSignAndSave(PdfSigningOptions, Stream, PdfSaveOptions)
Digitally signs the document using the specified signing and save options. Then saves the document to the specified stream.
Public methodSignAndSave(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.
Public methodSwapPages
Interchanges positions of two pages.
Public methodSyncMetadata
Synchronizes values in XMP Metadata and Document Info.
Public methodToString (Inherited from Object.)

Extension Methods

  NameDescription
Public Extension MethodAddFont(Font)Overloaded.
Adds the new font with the properties of the specified Font to the end of the collection of document fonts.
(Defined by PdfDocumentGdiExtensions.)
Public Extension MethodAddFont(String, FontStyle)Overloaded.
Adds the new font with specified properties to the end of the collection of document fonts.
(Defined by PdfDocumentGdiExtensions.)
Public Extension MethodAddImage(Image)Overloaded.
Adds new image(s) with the data and properties of specified Image to the end of the collection of document images.
(Defined by PdfDocumentGdiExtensions.)
Public Extension MethodAddImage(Image, PdfColor)Overloaded.
Creates image(s) with the data and properties of specified Image, applies specified mask color to them and adds resulting image(s) to the end of the collection of document images.
(Defined by PdfDocumentGdiExtensions.)
Public Extension MethodAddImage(Image, Image)Overloaded.
Creates a new image with the data and properties of specified Image, applies mask constructed from specified Image to it and adds resulting image to the end of the collection of document images.
(Defined by PdfDocumentGdiExtensions.)
Public Extension MethodOpenImage
Opens the image and constructs a collection of its frames (pages).
(Defined by PdfDocumentGdiExtensions.)

See Also