Click or drag to resize

PdfDocument Class

A PDF Document
Inheritance Hierarchy
SystemObject
  IronPdfPdfDocument

Namespace:  IronPdf
Assembly:  IronPdf (in IronPdf.dll) Version: 4.4.9.15720 (4.4.9.0)
Syntax
public class PdfDocument

The PdfDocument type exposes the following members.

Constructors
  NameDescription
Public methodPdfDocument(Byte, String)
Opens an existing PDF document for editing.
Public methodPdfDocument(Stream, String)
Opens an existing PDF document for editing.
Public methodPdfDocument(String, String)
Opens an existing PDF document for editing.
Top
Properties
  NameDescription
Public propertyBinaryData
Gets the binary data for the full PDF file as a byte array;
Public propertyForm
Gets an object returning any PDF editable form fields which can have their values both read and set programmatically.
Public propertyMetaData
MetaData information settings for the PDF.

Allows File meta-data to be read and set including: Authors, File Dates, Keywords, Title and Subject

Public propertyPageCount
Gets the number of pages in the PDF document.
Public propertySecuritySettings
Advanced security settings for the PDF.

Allows the developer to control user access passwords, encryption, and also who may edit, print and copy content from the PDF document

Public propertyStream
Gets the binary data for the full PDF file as a Stream
Top
Methods
  NameDescription
Public methodAddBackgroundPdf(String, Int32)
Adds a background to each page of this PDF. The background is copied from a page in another PDF document.
Public methodAddBackgroundPdf(PdfDocument, Int32)
Adds a background to each page of this PDF. The background is copied from a page in another PDF document.
Public methodAddBackgroundPdfToPage(Int32, PdfDocument, Int32)
Adds the background to one page of this PDF. The background is copied from a page in another PDF document.
Public methodAddBackgroundPdfToPage(Int32, String, Int32)
Adds the background to one page of this PDF. The background is copied from a page in another PDF document.
Public methodAddBackgroundPdfToPageRange(IEnumerableInt32, PdfDocument, Int32)
Adds the background to specified pages of this PDF. The background is copied from a page in another PDF document.
Public methodAddBackgroundPdfToPageRange(IEnumerableInt32, String, Int32)
Adds the background to specified pages of this PDF. The background is copied from a page in another PDF document.
Public methodAddBackgroundPdfToPageRange(Int32, Int32, PdfDocument, Int32)
Adds the background to a range of pages in this PDF. The background is copied from a page in another PDF document.
Public methodAddBackgroundPdfToPageRange(Int32, Int32, String, Int32)
Adds the background to a range of pages in this PDF. The background is copied from a page in another PDF document.
Public methodAddFooters(SimpleHeaderFooter, Boolean, IEnumerableInt32)
Renders page footers to an existing PDF File

Margin spacing on the PDF page for the footer are set to default values of 25mm. An overload method allow footer margins to be chosen specifically or set to zero.

Public methodAddFooters(SimpleHeaderFooter, Double, Double, Double, Boolean, IEnumerableInt32)
Renders page footers to an existing PDF File
Public methodAddForegroundOverlayPdf(String, Int32)
Adds an overlay to each page of this PDF. The foreground overlay is copied from a page in another PDF document.
Public methodAddForegroundOverlayPdf(PdfDocument, Int32)
Adds an overlay to each page of this PDF. The foreground overlay is copied from a page in another PDF document.
Public methodAddForegroundOverlayPdfToPage(Int32, PdfDocument, Int32)
Adds an overlay to one page of this PDF. The foreground overlay is copied from a page in another PDF document.
Public methodAddForegroundOverlayPdfToPage(Int32, String, Int32)
Adds an overlay to one page of this PDF. The foreground overlay is copied from a page in another PDF document.
Public methodAddForegroundOverlayPdfToPageRange(IEnumerableInt32, PdfDocument, Int32)
Adds an overlay to a range page of this PDF. The foreground overlay is copied from a page in another PDF document.
Public methodAddForegroundOverlayPdfToPageRange(IEnumerableInt32, String, Int32)
Adds an overlay to a range page of this PDF. The foreground overlay is copied from a page in another PDF document.
Public methodAddForegroundOverlayPdfToPageRange(Int32, Int32, PdfDocument, Int32)
Adds an overlay to a range page of this PDF. The foreground overlay is copied from a page in another PDF document.
Public methodAddForegroundOverlayPdfToPageRange(Int32, Int32, String, Int32)
Adds an overlay to a range page of this PDF. The foreground overlay is copied from a page in another PDF document.
Public methodAddHeaders(SimpleHeaderFooter, Boolean, IEnumerableInt32)
Renders page headers to an existing PDF File

Margin spacing on the PDF page for the header are set to default values of 25mm. An overload method allow header margins to be chosen specifically or set to zero.

Public methodAddHeaders(SimpleHeaderFooter, Double, Double, Double, Boolean, IEnumerableInt32)
Renders page headers to an existing PDF File
Public methodAddHTMLFooters
Renders HTML page footers to an existing PDF File

Margin spacing on the PDF page for the footer are set to default values of 25mm. An overload method allow footer margins to be chosen specifically or set to zero.

Public methodAddHTMLHeaders(HtmlHeaderFooter, Boolean, IEnumerableInt32)
Renders HTML page headers to an existing PDF File

Margin spacing on the PDF page for the header are set to default values of 25mm. An overload method allow header margins to be chosen specifically or set to zero.

Public methodAddHTMLHeaders(HtmlHeaderFooter, Double, Double, Double, Boolean, IEnumerableInt32)
Renders HTML page headers to an existing PDF File
Public methodAppendPdf
Appends another PDF to the end of the current PdfDocument
Public methodCopyPage
Creates a new PDF by copying a page from this PdfDocument.
Public methodCopyPages(IEnumerableInt32)
Creates a new PDF by copying a range of pages from this PdfDocument.
Public methodCopyPages(Int32, Int32)
Creates a new PDF by copying a range of pages from this PdfDocument.
Public methodEquals (Inherited from Object.)
Public methodExtractAllBitmaps
Finds all embedded Images from within the PDF and returns then as System.Drawing.Bitmap objects
Public methodExtractAllImages
Finds all embedded Images from within the PDF and returns then as System.Drawing.Image objects
Public methodExtractAllText
Extracts the written text content from the PDF and returns it as a string. Pages will be separated by 4 consecutive newline characters ("\n\n\n\n")
Public methodExtractBitmapsFromPage
Finds all embedded Images from within one page of the PDF and returns them as System.Drawing.Bitmap objects
Public methodExtractBitmapsFromPages(IEnumerableInt32)
Finds all embedded Images from within a specified pages in the PDF and returns them as System.Drawing.Bitmap objects
Public methodExtractBitmapsFromPages(Int32, Int32)
Finds all embedded Images from within a range of pages in the PDF and returns them as System.Drawing.Bitmap objects
Public methodExtractImagesFromPage
Finds all embedded Images from within one page of the PDF and returns them as System.Drawing.Image objects
Public methodExtractImagesFromPages(IEnumerableInt32)
Finds all embedded Images from within a specified pages in the PDF and returns them as System.Drawing.Image objects
Public methodExtractImagesFromPages(Int32, Int32)
Finds all embedded Images from within a range of pages in the PDF and returns them as System.Drawing.Bitmap objects
Public methodExtractTextFromPage
Extracts the text content from one page of the PDF and returns it as a string.
Public methodExtractTextFromPages(IEnumerableInt32)
Extracts the written text content from specified pages in the PDF PDF and returns it as a string. Pages will be separated by 4 consecutive newline characters ("\n\n\n\n")
Public methodExtractTextFromPages(Int32, Int32)
Extracts the written text content from a range of pages within the PDF and returns it as a string. Pages will be separated by 4 consecutive newline characters ("\n\n\n\n")
Public methodStatic memberFromFile
Opens an existing PDF document for editing.
Public methodGetHashCode (Inherited from Object.)
Public methodGetPrintDocument
Returns a PrintDocument for the PDF allowing developers granular control over sending the PDF to a Printer.

An assembly reference to System.Drawing is required in your project.

Public methodGetType (Inherited from Object.)
Public methodHtmlHeaderFooter
Renders HTML page footers to an existing PDF File
Public methodInsertPdf
Inserts another PDF into of the current PdfDocument, starting at a given Page Index.
Public methodStatic memberMerge(IEnumerablePdfDocument)
Static method that joins (concatenates) multiple PDF documents together into one compiled PDF document.
Public methodStatic memberMerge(PdfDocument, PdfDocument)
Static method that joins (concatenates) 2 PDF documents together into one final PDF document.
Public methodPageToBitmap(Int32)
Renders a single page of the PDF to a System.Drawing.Bitmap object.

Please add an assembly reference to System.Drawing to use this "PDF To Image" method

Please Dispose() each Bitmap object after use.

Public methodPageToBitmap(Int32, NullableInt32, NullableInt32)
Renders a single page of the PDF to a System.Drawing.Bitmap object.

Please add an assembly reference to System.Drawing to use this "PDF To Image" method

Please Dispose() each Bitmap object after use.

Public methodPrependPdf
Adds another PDF to the beginning of the current PdfDocument
Public methodPrint
Prints this PDF by sending it to the computer's default printer.

Windows print UI dialogs will be displayed to the user.

For advanced real-world printing options please see GetPrintDocument.

Public methodQuickSignPdfWithDigitalSignatureFile
Sign PDF with digital signature certificate. For more advanced Options please see QuickSignPdfWithDigitalSignatureFile(String, String) ///

Note that the PDF will not be fully signed until Saved using SaveAs(String), TrySaveAs(String), Stream or BinaryData. Multiple certificates may be used.

Public methodRasterizeToImageFiles(String, ImageType)
Renders the PDF and exports image Files in convenient formats. 1 image file is created for each page.

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodRasterizeToImageFiles(String, IEnumerableInt32, ImageType)
Renders the PDF and exports image Files in convenient formats. Page Numbers may be specified. 1 image file is created for each page.

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodRasterizeToImageFiles(String, NullableInt32, NullableInt32, ImageType)
Renders the PDF and exports image Files in convenient formats. Image dimensions may be specified. 1 image file is created for each page.

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodRasterizeToImageFiles(String, IEnumerableInt32, NullableInt32, NullableInt32, ImageType)
Renders the PDF and exports image Files in convenient formats. Page Numbers may be specified. 1 image file is created for each page.

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodRemovePage
Removes a page from the PDF at the given index.
Public methodRemovePages(IEnumerableInt32)
Removes a range of pages from the PDF
Public methodRemovePages(Int32, Int32)
Removes a range of pages from the PDF
Public methodSaveAs
Saves the PdfDocument to a file.
Public methodSignPdfWithDigitalSignature
Signs the PDF with digital signature with advanced options.

Note that the PDF will not be fully signed until Saved using SaveAs(String), TrySaveAs(String), Stream or BinaryData. Multiple certificates may be used.

Public methodStampHTML(HtmlStamp)
Edits the PDF by adding rendered HTML either behind or in-front of the existing contents of every page.
Public methodStampHTML(HtmlStamp, IEnumerableInt32)
Edits the PDF by adding rendered HTML either behind or in-front of the existing contents of specified pages.
Public methodStampHTML(HtmlStamp, Int32)
Edits the PDF by adding rendered HTML either behind or in-front of the existing contents of one page.
Public methodToBitmap
Rasterizes (renders) the PDF into System.Drawing.Bitmap objects. 1 Bitmap for each page.

Please add an assembly reference to System.Drawing to use this "PDF To Image" method.

Please Dispose() each Bitmap object after use.

Public methodToBitmap(IEnumerableInt32)
Rasterizes (renders) the PDF into System.Drawing.Bitmap objects.

Specific pages may be selected using the PageNumbers parameter.

Please add an assembly reference to System.Drawing to use this "PDF To Image" method

Please Dispose() each Bitmap object after use.

Public methodToBitmap(NullableInt32, NullableInt32, IEnumerableInt32)
Rasterizes (renders) the PDF into System.Drawing.Bitmap objects.

Specific pages may be selected using the PageNumbers parameter. The Widths and Height of the output images may be specified.

Please add an assembly reference to System.Drawing to use this "PDF To Image" method

Please Dispose() each Bitmap object after use.

Public methodToJpegImages(String)
Renders the pages of the PDF as JPEG files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodToJpegImages(String, IEnumerableInt32)
Renders the pages of the PDF as JPEG files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodToJpegImages(String, NullableInt32, NullableInt32)
Renders the pages of the PDF as JPEG files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodToJpegImages(String, IEnumerableInt32, NullableInt32, NullableInt32)
Renders the pages of the PDF as JPEG files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodToPngImages(String)
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodToPngImages(String, IEnumerableInt32)
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodToPngImages(String, NullableInt32, NullableInt32)
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodToPngImages(String, IEnumerableInt32, NullableInt32, NullableInt32)
Renders the pages of the PDF as PNG (Portable Network Graphic) files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodToString (Inherited from Object.)
Public methodToTiffImages(String)
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodToTiffImages(String, IEnumerableInt32)
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodToTiffImages(String, NullableInt32, NullableInt32)
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodToTiffImages(String, IEnumerableInt32, NullableInt32, NullableInt32)
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) files and saves them to disk.

Specific image dimensions and page numbers may be given as optional parameters

FileNamePattern should normally contain an asterisk (*) character which will be substituted for the page numbers

Public methodTrySaveAs
Attempt to save the PdfDocument to a file.
Public methodWatermarkAllPages
Watermarks all pages of this PDF with HTML content.

Watermarks are restricted to basic positioning and a 100mm by 100mm maximum size. For more advanced options see StampHTML(HtmlStamp)

Public methodWatermarkPage
Watermarks a single page of this PDF with HTML content.

Watermarks are restricted to basic positioning and a 100mm by 100mm maximum size. For more advanced options see StampHTML(HtmlStamp, Int32)

Public methodWatermarkPages
Watermarks all pages of this PDF with HTML content.

Watermarks are restricted to basic positioning and a 100mm by 100mm maximum size. For more advanced options see StampHTML(HtmlStamp, IEnumerableInt32)

Top
Fields
  NameDescription
Public fieldPassword
Sets a Password used to protect and encrypt the PDF File. Setting a password will cause IronPDF to automatically protect the PDF file content using strong 128 bit encryption. Setting the password to null will remove any existing password.
Top
See Also