Class PdfDocument
PdfDocument for IronPdf
Implements
Namespace: IronPdf
Assembly: IronPdf.dll
Syntax
public class PdfDocument : PdfClientAccessor
Constructors
PdfDocument(PdfDocument, String, String)
Clone a PDF document
Declaration
public PdfDocument(PdfDocument Document, string Password = "", string OwnerPassword = "")
Parameters
Type | Name | Description |
---|---|---|
PdfDocument | Document | Document to clone |
System.String | Password | Document password |
System.String | OwnerPassword | Document owner password |
PdfDocument(Byte[], String, String, ChangeTrackingModes)
Opens an existing PDF document for editing.
Adding a using declaration is not required. But can be used if you want to explicitly dispose. See: https://ironpdf.com/troubleshooting/ironpdf-using/
Declaration
public PdfDocument(byte[] PdfData, string Password = "", string OwnerPassword = "", ChangeTrackingModes TrackChanges)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | PdfData | The PDF file data as byte array. |
System.String | Password | Optional user password if the PDF document is encrypted. |
System.String | OwnerPassword | Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..). |
ChangeTrackingModes | TrackChanges | Optionally track changes to the document (for use with incremental saves) |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | Exception thrown if can not be opened. |
PdfDocument(Stream, String, String, ChangeTrackingModes)
Opens an existing PDF document for editing.
Adding a using declaration is not required. But can be used if you want to explicitly dispose. See: https://ironpdf.com/troubleshooting/ironpdf-using/
Declaration
public PdfDocument(Stream PdfDataStream, string Password = "", string OwnerPassword = "", ChangeTrackingModes TrackChanges)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | PdfDataStream | The PDF file data as a Stream. |
System.String | Password | Optional user password if the PDF document is encrypted. |
System.String | OwnerPassword | Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..). |
ChangeTrackingModes | TrackChanges | Optionally track changes to the document (for use with incremental saves) |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | Exception thrown if can not be opened. |
PdfDocument(String, String, String, ChangeTrackingModes)
Opens an existing PDF document for editing.
Adding a using declaration is not required. But can be used if you want to explicitly dispose. See: https://ironpdf.com/troubleshooting/ironpdf-using/
Declaration
public PdfDocument(string PdfFilePath, string Password = "", string OwnerPassword = "", ChangeTrackingModes TrackChanges)
Parameters
Type | Name | Description |
---|---|---|
System.String | PdfFilePath | The PDF file path. |
System.String | Password | Optional user password if the PDF document is encrypted. |
System.String | OwnerPassword | Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..). |
ChangeTrackingModes | TrackChanges | Optionally track changes to the document (for use with incremental saves) |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | Exception thrown if can not be opened. |
System.ArgumentException |
|
PdfDocument(Uri, String, String, ChangeTrackingModes)
Opens an existing PDF document from the specified Uri for editing.
Adding a using declaration is not required. But can be used if you want to explicitly dispose. See: https://ironpdf.com/troubleshooting/ironpdf-using/
Declaration
public PdfDocument(Uri PdfUri, string Password = "", string OwnerPassword = "", ChangeTrackingModes TrackChanges)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | PdfUri | The Uri to the PDF. |
System.String | Password | Optional user password if the PDF document is encrypted. |
System.String | OwnerPassword | Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..). |
ChangeTrackingModes | TrackChanges | Optionally track changes to the document (for use with incremental saves) |
Exceptions
Type | Condition |
---|---|
IronPdfProductException | Exception thrown if PDF cannot be found at URI or if password is incorrect. |
Properties
Annotations
Annotations collection
Declaration
public PdfAnnotationCollection Annotations { get; }
Property Value
Type | Description |
---|---|
PdfAnnotationCollection |
Attachments
Collection of attachments contained within the pdf document
Declaration
public PdfAttachmentCollection Attachments { get; }
Property Value
Type | Description |
---|---|
PdfAttachmentCollection |
BinaryData
Saves the PDF as byte array, including any changes. For incremental saves, see BinaryDataIncremental
Declaration
public byte[] BinaryData { get; }
Property Value
Type | Description |
---|---|
System.Byte[] | The PDF file as a byte array. |
BinaryDataIncremental
Saves the PDF as byte array with changes appended to the end of the file. For non-incremental saves, see BinaryData
For information on how to enable incremental saves see SaveAsRevision(String)
Declaration
public byte[] BinaryDataIncremental { get; }
Property Value
Type | Description |
---|---|
System.Byte[] | The PDF file as a byte array. |
Bookmarks
Hierarchy of navigational bookmarks contained at the top level of the document
Declaration
public PdfBookMarkCollection Bookmarks { get; }
Property Value
Type | Description |
---|---|
PdfBookMarkCollection |
Fonts
PDF Document's Font collection management.
Declaration
public PdfFontCollection Fonts { get; }
Property Value
Type | Description |
---|---|
PdfFontCollection |
Form
Gets an object returning any PDF editable form fields which can have their values both read and set programmatically.
Declaration
public IFormFieldCollection Form { get; }
Property Value
Type | Description |
---|---|
IFormFieldCollection | The form. |
MetaData
MetaData information settings for the PDF.
Allows File meta-data to be read and set including: Authors, File Dates, Keywords, Title and Subject
Declaration
public PdfMetaData MetaData { get; }
Property Value
Type | Description |
---|---|
PdfMetaData | MetaData settings for this PDF as an instance of PdfMetaData |
OwnerPassword
Sets the owner password and enables 128-bit encryption of PDF content. An owner password is one used to enable and disable all other security settings.
OwnerPassword must be set to a non empty string value forAllowUserCopyPasteContent,AllowUserAnnotations,AllowUserFormData,AllowUserPrinting andAllowUserEdits to be restricted.
Declaration
public string OwnerPassword { get; set; }
Property Value
Type | Description |
---|---|
System.String |
PageCount
Gets the number of pages in the PDF document.
Declaration
public int PageCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The page count. |
Pages
Gets the list of pages in the PDF document.
Declaration
public PdfPagesCollection Pages { get; }
Property Value
Type | Description |
---|---|
PdfPagesCollection |
Password
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.
Declaration
public string Password { get; set; }
Property Value
Type | Description |
---|---|
System.String |
RevisionCount
Number of revisions available in the document. See SaveAsRevision(String)
Declaration
public int RevisionCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
SecuritySettings
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
Declaration
public PdfSecuritySettings SecuritySettings { get; }
Property Value
Type | Description |
---|---|
PdfSecuritySettings | Advanced security settings for this PDF as an instance of PdfSecuritySettings |
Stream
Gets the binary data for the full PDF file as a Stream.
This Stream is System.IDisposable and should be disposed with "using" or "Dispose()" methods.
Declaration
public MemoryStream Stream { get; }
Property Value
Type | Description |
---|---|
System.IO.MemoryStream | The PDF file as a new MemoryStream which is System.IDisposable and should be disposed with "using" or "Dispose()" methods. |
Methods
AddBackgroundPdf(PdfDocument, Int32)
Adds a background to each page of this PDF. The background is copied from a page in another PDF document.
Declaration
public PdfDocument AddBackgroundPdf(PdfDocument BackgroundPdf, int BackgroundPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
PdfDocument | BackgroundPdf | The Background PDF as a PdfDocument. |
System.Int32 | BackgroundPdfPageIndex | Index (zero-based page number) to copy from the BackgroundPdf. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddBackgroundPdf(String, Int32)
Adds a background to each page of this PDF. The background is copied from a page in another PDF document.
Declaration
public PdfDocument AddBackgroundPdf(string BackgroundPdfPath, int BackgroundPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | BackgroundPdfPath | The background PDF's file path. |
System.Int32 | BackgroundPdfPageIndex | Index (zero-based page number) to copy from the BackgroundPdf. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddBackgroundPdfToPage(Int32, PdfDocument, Int32)
Adds the background to one page of this PDF. The background is copied from a page in another PDF document.
Declaration
public PdfDocument AddBackgroundPdfToPage(int ToPageIndex, PdfDocument BackgroundPdf, int BackgroundPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | ToPageIndex | Index (zero-based page number) of the page of this PDF to which the background will be applied to. |
PdfDocument | BackgroundPdf | The Background PDF as a PdfDocument. |
System.Int32 | BackgroundPdfPageIndex | Index (zero-based page number) to copy from the BackgroundPdf. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddBackgroundPdfToPage(Int32, String, Int32)
Adds the background to one page of this PDF. The background is copied from a page in another PDF document.
Declaration
public PdfDocument AddBackgroundPdfToPage(int ToPageIndex, string BackgroundPdfPath, int BackgroundPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | ToPageIndex | Index (zero-based page number) of the page of this PDF to which the background will be applied to. |
System.String | BackgroundPdfPath | The background PDF path. |
System.Int32 | BackgroundPdfPageIndex | Index (zero-based page number) to copy from the BackgroundPdf. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddBackgroundPdfToPageRange(IEnumerable<Int32>, PdfDocument, Int32)
Adds the background to specified pages of this PDF. The background is copied from a page in another PDF document.
Declaration
public PdfDocument AddBackgroundPdfToPageRange(IEnumerable<int> ToPageIndexes, PdfDocument BackgroundPdf, int BackgroundPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | ToPageIndexes | A list of Indexes (zero-based page numbers) of pages in this PDF to which the background will be applied to. |
PdfDocument | BackgroundPdf | The Background PDF as a PdfDocument. |
System.Int32 | BackgroundPdfPageIndex | Index (zero-based page number) to copy from the BackgroundPdf. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddBackgroundPdfToPageRange(IEnumerable<Int32>, String, Int32)
Adds the background to specified pages of this PDF. The background is copied from a page in another PDF document.
Declaration
public PdfDocument AddBackgroundPdfToPageRange(IEnumerable<int> ToPageIndexes, string BackgroundPdfPath, int BackgroundPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | ToPageIndexes | A list of Indexes (zero-based page numbers) of pages in this PDF to which the background will be applied to. |
System.String | BackgroundPdfPath | The background PDF path. |
System.Int32 | BackgroundPdfPageIndex | Index (zero-based page number) to copy from the BackgroundPdf. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddBackgroundPdfToPageRange(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.
Declaration
public PdfDocument AddBackgroundPdfToPageRange(int StartPageIndex, int EndPageIndex, PdfDocument BackgroundPdf, int BackgroundPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | StartPageIndex | First index (zero-based page number) to start adding backgrounds to . |
System.Int32 | EndPageIndex | Last index (zero-based page number) to end adding backgrounds to. |
PdfDocument | BackgroundPdf | The Background PDF as a PdfDocument. |
System.Int32 | BackgroundPdfPageIndex | Index (zero-based page number) to copy from the BackgroundPdf. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddBackgroundPdfToPageRange(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.
Declaration
public PdfDocument AddBackgroundPdfToPageRange(int StartPageIndex, int EndPageIndex, string BackgroundPdfPath, int BackgroundPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | StartPageIndex | First index (zero-based page number) to start adding backgrounds to . |
System.Int32 | EndPageIndex | Last index (zero-based page number) to end adding backgrounds to. |
System.String | BackgroundPdfPath | The background PDF path. |
System.Int32 | BackgroundPdfPageIndex | Index (zero-based page number) to copy from the BackgroundPdf. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddForegroundOverlayPdf(PdfDocument, Int32)
Adds an overlay to each page of this PDF. The foreground overlay is copied from a page in another PDF document.
Declaration
public PdfDocument AddForegroundOverlayPdf(PdfDocument OverlayPdf, int OverlayPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
PdfDocument | OverlayPdf | The overlay PDF as a PdfDocument. |
System.Int32 | OverlayPdfPageIndex | Index (zero-based page number) to copy from the Overlay PDF. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddForegroundOverlayPdf(String, Int32)
Adds an overlay to each page of this PDF. The foreground overlay is copied from a page in another PDF document.
Declaration
public PdfDocument AddForegroundOverlayPdf(string OverlayPdfPath, int OverlayPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | OverlayPdfPath | The background PDF's file path. |
System.Int32 | OverlayPdfPageIndex | Index (zero-based page number) to copy from the Overlay PDF. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddForegroundOverlayPdfToPage(Int32, PdfDocument, Int32)
Adds an overlay to one page of this PDF. The foreground overlay is copied from a page in another PDF document.
Declaration
public PdfDocument AddForegroundOverlayPdfToPage(int ToPageIndex, PdfDocument OverlayPdf, int OverlayPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | ToPageIndex | Index (zero-based page number) of the page of this PDF to which the foreground will be applied to. |
PdfDocument | OverlayPdf | The overlay PDF as a PdfDocument. |
System.Int32 | OverlayPdfPageIndex | Index (zero-based page number) to copy from the Overlay PDF. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddForegroundOverlayPdfToPage(Int32, String, Int32)
Adds an overlay to one page of this PDF. The foreground overlay is copied from a page in another PDF document.
Declaration
public PdfDocument AddForegroundOverlayPdfToPage(int ToPageIndex, string OverlayPdfPath, int OverlayPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | ToPageIndex | Index (zero-based page number) of the page of this PDF to which the foreground will be applied to. |
System.String | OverlayPdfPath | The overlay PDF path. |
System.Int32 | OverlayPdfPageIndex | Index (zero-based page number) to copy from the Overlay PDF. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddForegroundOverlayPdfToPageRange(IEnumerable<Int32>, PdfDocument, Int32)
Adds an overlay to a range or pages of this PDF. The foreground overlay is copied from a page in another PDF document.
Declaration
public PdfDocument AddForegroundOverlayPdfToPageRange(IEnumerable<int> ToPageIndexes, PdfDocument OverlayPdf, int OverlayPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | ToPageIndexes | A list of Indexes (zero-based page numbers) of pages in this PDF to which the overlay will be applied to. |
PdfDocument | OverlayPdf | The overlay PDF as a PdfDocument. |
System.Int32 | OverlayPdfPageIndex | Index (zero-based page number) to copy from the Overlay PDF. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddForegroundOverlayPdfToPageRange(IEnumerable<Int32>, String, Int32)
Adds an overlay to a range or pages of this PDF. The foreground overlay is copied from a page in another PDF document.
Declaration
public PdfDocument AddForegroundOverlayPdfToPageRange(IEnumerable<int> ToPageIndexes, string OverlayPdfPath, int OverlayPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | ToPageIndexes | A list of Indexes (zero-based page numbers) of pages in this PDF to which the overlay will be applied to. |
System.String | OverlayPdfPath | The overlay PDF path. |
System.Int32 | OverlayPdfPageIndex | Index (zero-based page number) to copy from the Overlay PDF. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddForegroundOverlayPdfToPageRange(Int32, Int32, PdfDocument, Int32)
Adds an overlay to a range or pages of this PDF. The foreground overlay is copied from a page in another PDF document.
Declaration
public PdfDocument AddForegroundOverlayPdfToPageRange(int StartPageIndex, int EndPageIndex, PdfDocument OverlayPdf, int OverlayPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | StartPageIndex | First index (zero-based page number) to start adding overlays to . |
System.Int32 | EndPageIndex | Last index (zero-based page number) to end adding overlays to. |
PdfDocument | OverlayPdf | The overlay PDF as a PdfDocument. |
System.Int32 | OverlayPdfPageIndex | Index (zero-based page number) to copy from the Overlay PDF. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddForegroundOverlayPdfToPageRange(Int32, Int32, String, Int32)
Adds an overlay to a range or pages of this PDF. The foreground overlay is copied from a page in another PDF document.
Declaration
public PdfDocument AddForegroundOverlayPdfToPageRange(int StartPageIndex, int EndPageIndex, string OverlayPdfPath, int OverlayPdfPageIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | StartPageIndex | First index (zero-based page number) to start adding overlays to . |
System.Int32 | EndPageIndex | Last index (zero-based page number) to end adding overlays to. |
System.String | OverlayPdfPath | The overlay PDF path. |
System.Int32 | OverlayPdfPageIndex | Index (zero-based page number) to copy from the Overlay PDF. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddHtmlFooters(HtmlHeaderFooter, Double, Double, Double, Int32, IEnumerable<Int32>)
Stamps HTML page footers on top of an existing Pdf.
Declaration
public PdfDocument AddHtmlFooters(HtmlHeaderFooter Footer, double MarginLeft, double MarginRight, double MarginBottom, int FirstPageNumber = 1, IEnumerable<int> PageIndexesToAddFootersTo = null)
Parameters
Type | Name | Description |
---|---|---|
HtmlHeaderFooter | Footer | A new instance of IronPdf.HtmlHeaderFooter that defines the footer content and layout. |
System.Double | MarginLeft | The left margin of the footer on the page in mm. |
System.Double | MarginRight | The right margin of the footer on the page in mm. |
System.Double | MarginBottom | The bottom margin of the footer on the page in mm. |
System.Int32 | FirstPageNumber | Optional. The number of first page for {page} mail-merge. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToAddFootersTo | Optional. The PageIndexes (zero-based page numbers) to which the footer will be added. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddHtmlFooters(HtmlHeaderFooter, Int32, IEnumerable<Int32>)
Stamps HTML page footers on top of an existing Pdf.
Positioning can be adjusted using the AddHtmlFooters(HtmlHeaderFooter, Double, Double, Double, Int32, IEnumerable<Int32>) overload of this method.
Declaration
public PdfDocument AddHtmlFooters(HtmlHeaderFooter Footer, int FirstPageNumber = 1, IEnumerable<int> PageIndexesToAddFootersTo = null)
Parameters
Type | Name | Description |
---|---|---|
HtmlHeaderFooter | Footer | A new instance of IronPdf.HtmlHeaderFooter that defines the footer content and layout. |
System.Int32 | FirstPageNumber | Optional. The number of first page for {page} mail-merge. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToAddFootersTo | Optional. The PageIndexes (zero-based page numbers) to which the footer will be added. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddHtmlHeaders(HtmlHeaderFooter, Double, Double, Double, Int32, IEnumerable<Int32>)
Stamps HTML page headers on top of an existing Pdf.
Declaration
public PdfDocument AddHtmlHeaders(HtmlHeaderFooter Header, double MarginLeft, double MarginRight, double MarginTop, int FirstPageNumber = 1, IEnumerable<int> PageIndexesToAddHeadersTo = null)
Parameters
Type | Name | Description |
---|---|---|
HtmlHeaderFooter | Header | A new instance of IronPdf.HtmlHeaderFooter that defines the header content and layout. |
System.Double | MarginLeft | The left margin of the header on the page in mm. |
System.Double | MarginRight | The right margin of the header on the page in mm. |
System.Double | MarginTop | The top margin of the header on the page in mm. |
System.Int32 | FirstPageNumber | Optional. The number of first page for {page} mail-merge. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToAddHeadersTo | Optional. The PageIndexes (zero-based page numbers) to which the header will be added. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddHtmlHeaders(HtmlHeaderFooter, Int32, IEnumerable<Int32>)
Stamps HTML page headers on top of an existing PDF.
Positioning can be adjusted using the AddHtmlHeaders(HtmlHeaderFooter, Double, Double, Double, Int32, IEnumerable<Int32>) to specify header margins
Declaration
public PdfDocument AddHtmlHeaders(HtmlHeaderFooter Header, int FirstPageNumber = 1, IEnumerable<int> PageIndexesToAddHeadersTo = null)
Parameters
Type | Name | Description |
---|---|---|
HtmlHeaderFooter | Header | A new instance of IronPdf.HtmlHeaderFooter that defines the header content and layout. |
System.Int32 | FirstPageNumber | Optional. The number of first page for {page} mail-merge. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToAddHeadersTo | Optional. The PageIndexes (zero-based page numbers) to which the header will be added. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddHtmlHeadersAndFooters(ChromePdfRenderOptions, IEnumerable<Int32>)
Stamps HTML headers and footers on top of an existing PDF using the specified render options and optional list of page indices.
Declaration
public PdfDocument AddHtmlHeadersAndFooters(ChromePdfRenderOptions Options, IEnumerable<int> PageIndexes = null)
Parameters
Type | Name | Description |
---|---|---|
ChromePdfRenderOptions | Options | Render options for the HTML headers and footers |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | Optional list of page indices to apply headers and footers to. Defaults to all pages |
Returns
Type | Description |
---|---|
PdfDocument | Pdf document |
AddTextFooters(TextHeaderFooter, Double, Double, Double, Int32, IEnumerable<Int32>)
Stamps page footers on top of an existing Pdf.
Declaration
public PdfDocument AddTextFooters(TextHeaderFooter Footer, double MarginLeft, double MarginRight, double MarginBottom, int FirstPageNumber = 1, IEnumerable<int> PageIndexesToAddFootersTo = null)
Parameters
Type | Name | Description |
---|---|---|
TextHeaderFooter | Footer | A new instance of IronPdf.SimpleHeaderFooter that defines the footer content and layout. |
System.Double | MarginLeft | The left margin of the footer on the page in mm. |
System.Double | MarginRight | The right margin of the footer on the page in mm. |
System.Double | MarginBottom | The bottom margin of the footer on the page in mm. |
System.Int32 | FirstPageNumber | Optional. The number of first page for {page} mail-merge. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToAddFootersTo | Optional. The PageIndexes (zero-based page numbers) to which the footer will be added. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddTextFooters(TextHeaderFooter, Int32, IEnumerable<Int32>)
Stamps page footers on top of an existing Pdf.
Positioning can be adjusted using the AddTextFooters(TextHeaderFooter, Double, Double, Double, Int32, IEnumerable<Int32>) overload of this method.
Declaration
public PdfDocument AddTextFooters(TextHeaderFooter Footer, int FirstPageNumber = 1, IEnumerable<int> PageIndexesToAddFootersTo = null)
Parameters
Type | Name | Description |
---|---|---|
TextHeaderFooter | Footer | A new instance of IronPdf.TextHeaderFooter that defines the footer content. |
System.Int32 | FirstPageNumber | Optional. The number of first page for {page} mail-merge. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToAddFootersTo | Optional. The PageIndexes (zero-based page numbers) to which the footer will be added. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddTextHeaders(TextHeaderFooter, Double, Double, Double, Int32, IEnumerable<Int32>)
Stamps page headers on top of an existing Pdf.
Declaration
public PdfDocument AddTextHeaders(TextHeaderFooter Header, double MarginLeft, double MarginRight, double MarginTop, int FirstPageNumber = 1, IEnumerable<int> PageIndexesToAddHeadersTo = null)
Parameters
Type | Name | Description |
---|---|---|
TextHeaderFooter | Header | A new instance of IronPdf.SimpleHeaderFooter that defines the header content and layout. |
System.Double | MarginLeft | The left margin of the header on the page in mm. |
System.Double | MarginRight | The right margin of the header on the page in mm. |
System.Double | MarginTop | The top margin of the header on the page in mm. |
System.Int32 | FirstPageNumber | Optional. The number of first page for {page} mail-merge. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToAddHeadersTo | Optional. The PageIndexes (zero-based page numbers) to which the header will be added. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddTextHeaders(TextHeaderFooter, Int32, IEnumerable<Int32>)
Stamps page headers on top of an existing Pdf.
Positioning can be adjusted using the AddTextHeaders(TextHeaderFooter, Double, Double, Double, Int32, IEnumerable<Int32>) overload of this method.
Declaration
public PdfDocument AddTextHeaders(TextHeaderFooter Header, int FirstPageNumber = 1, IEnumerable<int> PageIndexesToAddHeadersTo = null)
Parameters
Type | Name | Description |
---|---|---|
TextHeaderFooter | Header | A new instance of IronPdf.TextHeaderFooter that defines the header content and layout. |
System.Int32 | FirstPageNumber | Optional. The number of first page for {page} mail-merge. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToAddHeadersTo | Optional. The PageIndexes (zero-based page numbers) to which the header will be added. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
AddTextHeadersAndFooters(ChromePdfRenderOptions, IEnumerable<Int32>)
Stamps text headers and footers on top of an existing PDF using the specified render options and optional list of page indices.
Declaration
public PdfDocument AddTextHeadersAndFooters(ChromePdfRenderOptions Options, IEnumerable<int> PageIndexes = null)
Parameters
Type | Name | Description |
---|---|---|
ChromePdfRenderOptions | Options | Render options for the text headers and footers |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | Optional list of page indices to apply headers and footers to. Defaults to all pages |
Returns
Type | Description |
---|---|
PdfDocument | Pdf document |
AppendPdf(PdfDocument)
Appends another PDF to the end of the current PdfDocument If AnotherPdfFile contains form fields, those fields will be appended with '' in the resulting PDF. e.g. 'Name' will be 'Name'
Declaration
public PdfDocument AppendPdf(PdfDocument AnotherPdfFile)
Parameters
Type | Name | Description |
---|---|---|
PdfDocument | AnotherPdfFile | PdfDocument to append. |
Returns
Type | Description |
---|---|
PdfDocument | A new PdfDocument |
ApplyMultipleStamps(IEnumerable<Stamper>, IEnumerable<Int32>)
Declaration
public PdfDocument ApplyMultipleStamps(IEnumerable<Stamper> Stampers, IEnumerable<int> PageIndexesToStamp = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Stamper> | Stampers | A list of Stamper objects, each with their own HTML stamp, to all be stamped onto the PDF. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The page indexes (zero-based page number) to apply the stamps to. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyMultipleStamps(IEnumerable<Stamper>, Int32)
Declaration
public PdfDocument ApplyMultipleStamps(IEnumerable<Stamper> Stampers, int PageIndexToStamp)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Stamper> | Stampers | A list of Stamper objects, each with their own HTML stamp, to all be stamped onto the PDF. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to apply the stamps to. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyMultipleStampsAsync(IEnumerable<Stamper>)
Declaration
public Task<PdfDocument> ApplyMultipleStampsAsync(IEnumerable<Stamper> Stampers)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Stamper> | Stampers | A list of Stamper objects, each with their own HTML stamp, to all be stamped onto the PDF. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyMultipleStampsAsync(IEnumerable<Stamper>, IEnumerable<Int32>)
Declaration
public Task<PdfDocument> ApplyMultipleStampsAsync(IEnumerable<Stamper> Stampers, IEnumerable<int> PageIndexesToStamp)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Stamper> | Stampers | A list of Stamper objects, each with their own HTML stamp, to all be stamped onto the PDF. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The page indexes (zero-based page number) to apply the stamps to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyMultipleStampsAsync(IEnumerable<Stamper>, Int32)
Declaration
public Task<PdfDocument> ApplyMultipleStampsAsync(IEnumerable<Stamper> Stampers, int PageIndexToStamp)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Stamper> | Stampers | A list of Stamper objects, each with their own HTML stamp, to all be stamped onto the PDF. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to apply the stamps to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyStamp(Stamper)
Declaration
public PdfDocument ApplyStamp(Stamper Stamper)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyStamp(Stamper, IEnumerable<Int32>)
Declaration
public PdfDocument ApplyStamp(Stamper Stamper, IEnumerable<int> PageIndexesToStamp)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The list of page indexes (zero-based page number) to apply the stamp to. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyStamp(Stamper, Int32)
Declaration
public PdfDocument ApplyStamp(Stamper Stamper, int PageIndexToStamp)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to apply the stamp to. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyStampAsync(Stamper)
Declaration
public Task<PdfDocument> ApplyStampAsync(Stamper Stamper)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
Remarks
Please wait for the task to be completed before saving to file!
ApplyStampAsync(Stamper, IEnumerable<Int32>)
Declaration
public Task<PdfDocument> ApplyStampAsync(Stamper Stamper, IEnumerable<int> PageIndexesToStamp)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The page indexes (zero-based page number) to apply the stamps to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
Remarks
Please wait for the task to be completed before saving to file!
ApplyStampAsync(Stamper, Int32)
Declaration
public Task<PdfDocument> ApplyStampAsync(Stamper Stamper, int PageIndexToStamp)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to apply the stamp to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
Remarks
Please wait for the task to be completed before saving to file!
ApplyWatermark(String, Int32, VerticalAlignment, HorizontalAlignment)
Adds Watermark to PDF, Please use ApplyStamp(Stamper) for more control.
For more information and a code example please visit: https://ironpdf.com/tutorials/csharp-edit-pdf-complete-tutorial/#add-a-watermark-to-a-pdf
Declaration
public PdfDocument ApplyWatermark(string html, int opacity = 50, VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment)
Parameters
Type | Name | Description |
---|---|---|
System.String | html | The HTML fragment which will be stamped onto your PDF. |
System.Int32 | opacity | Watermark transparent value. 0 is invisible, 100 if fully opaque. |
VerticalAlignment | verticalAlignment | The vertical alignment of the watermark relative to the page. |
HorizontalAlignment | horizontalAlignment | The horizontal alignment of the watermark relative to the page. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyWatermark(String, Int32, Int32, VerticalAlignment, HorizontalAlignment)
Adds Watermark to PDF, Please use ApplyStamp(Stamper) for more control.
For more information and a code example please visit: https://ironpdf.com/tutorials/csharp-edit-pdf-complete-tutorial/#add-a-watermark-to-a-pdf
Declaration
public PdfDocument ApplyWatermark(string html, int rotation, int opacity = 50, VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment)
Parameters
Type | Name | Description |
---|---|---|
System.String | html | The HTML fragment which will be stamped onto your PDF. |
System.Int32 | rotation | Rotates the watermark clockwise from 0 to 360 degrees as specified. |
System.Int32 | opacity | Watermark transparent value. 0 is invisible, 100 if fully opaque. |
VerticalAlignment | verticalAlignment | The vertical alignment of the watermark relative to the page. |
HorizontalAlignment | horizontalAlignment | The horizontal alignment of the watermark relative to the page. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
CompressImages(Int32, Boolean)
Compress existing images using JPG encoding and the specified settings
Declaration
public void CompressImages(int Quality, bool ScaleToVisibleSize = true)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Quality | Quality (1 - 100) to use during compression |
System.Boolean | ScaleToVisibleSize | Scale down the image resolution according to its visible size in the PDF document |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Argument out of range |
CompressStructTree()
Remove document struct tree information which describes the logical layout of the document.
Removing the "structure tree" can significantly reduce the disk space used by the document.
Removing the "structure tree" of a complicated document can negatively impact text selection.
Declaration
public void CompressStructTree()
ConvertToPdfA(PdfAVersions, String)
Convert the current document into the specified PDF-A standard format with selected icc file
Declaration
public PdfDocument ConvertToPdfA(PdfAVersions PdfAVersion, string CustomICC = null)
Parameters
Type | Name | Description |
---|---|---|
PdfAVersions | PdfAVersion | (Optional) PDF-A standard format |
System.String | CustomICC | (Optional) Custom color profile file path |
Returns
Type | Description |
---|---|
PdfDocument | A PDF/A compliant reference to this document |
ConvertToPdfUA(PdfUAVersions)
Convert the current document into the specified PDF/UA standard format
Declaration
public PdfDocument ConvertToPdfUA(PdfUAVersions PdfUAVersion)
Parameters
Type | Name | Description |
---|---|---|
PdfUAVersions | PdfUAVersion | PDF-UA standard format |
Returns
Type | Description |
---|---|
PdfDocument | A PDF/A compliant reference to this document |
CopyPage(Int32)
Creates a new PDF by copying a page from this PdfDocument.
Declaration
public PdfDocument CopyPage(int PageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Index of the page. Note: Page 1 has index 0... |
Returns
Type | Description |
---|---|
PdfDocument | A new PdfDocument |
CopyPages(IEnumerable<Int32>)
Creates a new PDF by copying a range of pages from this PdfDocument.
Declaration
public PdfDocument CopyPages(IEnumerable<int> PageIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | An IEnumerable of page indexes to copy into the new PDF. |
Returns
Type | Description |
---|---|
PdfDocument | A new PdfDocument |
CopyPages(Int32, Int32)
Creates a new PDF by copying a range of pages from this PdfDocument.
Declaration
public PdfDocument CopyPages(int StartIndex, int EndIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | StartIndex | The index of the first PDF page to copy.. Note: Page 1 has index 0 |
System.Int32 | EndIndex | The index of the last PDF page to copy.> |
Returns
Type | Description |
---|---|
PdfDocument | A new PdfDocument |
Dispose()
Releases used resources.
Declaration
public void Dispose()
DrawBitmap(AnyBitmap, IEnumerable<Int32>, IEnumerable<Double>, IEnumerable<Double>, IEnumerable<Double>, IEnumerable<Double>, PixelFormat)
Draw a bitmap multiple times according to the specified parameters; all occurrences of the bitmap will share a single data stream
Declaration
public void DrawBitmap(AnyBitmap Bitmap, IEnumerable<int> PageIndices, IEnumerable<double> XCoordinates, IEnumerable<double> YCoordinates, IEnumerable<double> DesiredWidths, IEnumerable<double> DesiredHeights, PixelFormat PixelFormat)
Parameters
Type | Name | Description |
---|---|---|
IronSoftware.Drawing.AnyBitmap | Bitmap | AnyBitmap to draw |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndices | Target page indices |
System.Collections.Generic.IEnumerable<System.Double> | XCoordinates | X coordinates |
System.Collections.Generic.IEnumerable<System.Double> | YCoordinates | Y coordinates |
System.Collections.Generic.IEnumerable<System.Double> | DesiredWidths | Desired widths |
System.Collections.Generic.IEnumerable<System.Double> | DesiredHeights | Desired heights |
PixelFormat | PixelFormat | Pixel format |
DrawBitmap(AnyBitmap, Int32, Double, Double, Double, Double, PixelFormat)
Draw a bitmap a single time according to the specified parameters
Declaration
public void DrawBitmap(AnyBitmap Bitmap, int PageIndex, double X, double Y, double DesiredWidth, double DesiredHeight, PixelFormat PixelFormat)
Parameters
Type | Name | Description |
---|---|---|
IronSoftware.Drawing.AnyBitmap | Bitmap | Bitmap to draw |
System.Int32 | PageIndex | Page index |
System.Double | X | X coordinate |
System.Double | Y | Y coordinate |
System.Double | DesiredWidth | Desired width |
System.Double | DesiredHeight | Desired Height |
PixelFormat | PixelFormat | Pixel format |
DrawText(String, String, Double, Int32, Double, Double, Color, Double)
Draw text according to the specified parameters
Declaration
public void DrawText(string Text, string FontName, double FontSize, int PageIndex, double X, double Y, Color Color, double Rotation)
Parameters
Type | Name | Description |
---|---|---|
System.String | Text | Text to draw |
System.String | FontName | Font name (must be a system font or already exist in the document) |
System.Double | FontSize | Font size |
System.Int32 | PageIndex | Page index |
System.Double | X | X coordinate |
System.Double | Y | Y coordinate |
IronSoftware.Drawing.Color | Color | Desired font color |
System.Double | Rotation | Text rotation (degrees, clockwise) |
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
ExtractAllBitmaps()
Finds all embedded Images from within the PDF and returns then as IronSoftware.Drawing.AnyBitmap objects
Declaration
public List<AnyBitmap> ExtractAllBitmaps()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<IronSoftware.Drawing.AnyBitmap> | The extracted images as IronSoftware.Drawing.AnyBitmap |
ExtractAllImages()
Finds all embedded Images from within the PDF and returns then as IronSoftware.Drawing.AnyBitmap objects
Declaration
public List<AnyBitmap> ExtractAllImages()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<IronSoftware.Drawing.AnyBitmap> | The extracted images as IronSoftware.Drawing.AnyBitmap |
ExtractAllRawImages()
Extracts all images from a PDf document. Images are returned as their raw data in as Byte Arrays (byte[])
Declaration
public List<byte[]> ExtractAllRawImages()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Byte[]> | An Enumerable of Byte Arrays. Each Byte Array represents one image. |
ExtractAllText()
Extracts the written text content from the PDF and returns it as a string.
Pages are be separated by 4 consecutive Environment.NewLines
Declaration
public string ExtractAllText()
Returns
Type | Description |
---|---|
System.String | All text in the PDF as a string. |
ExtractBitmapsFromPage(Int32)
Finds all embedded Images from within one page of the PDF and returns them as IronSoftware.Drawing.AnyBitmap objects
Declaration
public List<AnyBitmap> ExtractBitmapsFromPage(int PageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Index of the page. Note: Page 1 has index 0... |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<IronSoftware.Drawing.AnyBitmap> | The extracted images as IronSoftware.Drawing.AnyBitmap Objects |
ExtractBitmapsFromPages(IEnumerable<Int32>)
Finds all embedded Images from within a specified pages in the PDF and returns them as IronSoftware.Drawing.AnyBitmap objects
Declaration
public List<AnyBitmap> ExtractBitmapsFromPages(IEnumerable<int> PageIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | An IEnumerable list of page indexes. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<IronSoftware.Drawing.AnyBitmap> | IEnumerable of AnyBitmap. The extracted images as IronSoftware.Drawing.AnyBitmap Objects |
ExtractBitmapsFromPages(Int32, Int32)
Finds all embedded Images from within a range of pages in the PDF and returns them as IronSoftware.Drawing.AnyBitmap objects
Declaration
public List<AnyBitmap> ExtractBitmapsFromPages(int StartIndex, int EndIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | StartIndex | The index of the first PDF page to extract images from.. Note: Page 1 has index 0 |
System.Int32 | EndIndex | The index of the last PDF page to extract images from. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<IronSoftware.Drawing.AnyBitmap> | The extracted images as IronSoftware.Drawing.AnyBitmap Objects |
ExtractImagesFromPage(Int32)
Finds all embedded Images from within one page of the PDF and returns them as IronSoftware.Drawing.AnyBitmap objects
Declaration
public List<AnyBitmap> ExtractImagesFromPage(int PageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Index of the page. Note: Page 1 has index 0... |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<IronSoftware.Drawing.AnyBitmap> | The extracted images as IronSoftware.Drawing.AnyBitmap Objects |
ExtractImagesFromPages(IEnumerable<Int32>)
Finds all embedded Images from within a specified pages in the PDF and returns them as IronSoftware.Drawing.AnyBitmap objects
Declaration
public List<AnyBitmap> ExtractImagesFromPages(IEnumerable<int> PageIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | An IEnumerable list of page indexes. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<IronSoftware.Drawing.AnyBitmap> | The extracted images as IronSoftware.Drawing.AnyBitmap Objects |
ExtractImagesFromPages(Int32, Int32)
Finds all embedded Images from within a range of pages in the PDF and returns them as IronSoftware.Drawing.AnyBitmap objects
Declaration
public List<AnyBitmap> ExtractImagesFromPages(int StartIndex, int EndIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | StartIndex | The index of the first PDF page to extract images from.. Note: Page 1 has index 0 |
System.Int32 | EndIndex | The index of the last PDF page to extract images from. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<IronSoftware.Drawing.AnyBitmap> | The extracted images as IronSoftware.Drawing.AnyBitmap Objects |
ExtractRawImagesFromPage(Int32)
Finds all embedded Images from within one page of the PDF and returns them as raw image byte array objects
Declaration
public List<byte[]> ExtractRawImagesFromPage(int PageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Index of the page. Note: Page 1 has index 0... |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Byte[]> | List of raw image byte array. |
ExtractRawImagesFromPages(IEnumerable<Int32>)
Finds all embedded Images from specified pages in the PDF and returns them as raw image byte array objects objects
Declaration
public List<byte[]> ExtractRawImagesFromPages(IEnumerable<int> PageIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | An IEnumerable list of page indexes. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Byte[]> | List of raw image byte array. |
ExtractRawImagesFromPages(Int32, Int32)
Finds all embedded Images from within a range of pages in the PDF and returns them as raw image byte array objects
Declaration
public List<byte[]> ExtractRawImagesFromPages(int StartIndex, int EndIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | StartIndex | The index of the first PDF page to extract images from.. Note: Page 1 has index 0 |
System.Int32 | EndIndex | The index of the last PDF page to extract images from. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Byte[]> | List of raw image byte array. |
ExtractTextFromPage(Int32)
Extracts the text content from one page of the PDF and returns it as a string.
Declaration
public string ExtractTextFromPage(int pageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | Index of the page. Note: Page 1 has index 0... |
Returns
Type | Description |
---|---|
System.String | The text extracted from the PDF page as a string. |
ExtractTextFromPages(IEnumerable<Int32>)
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 Environment.NewLines
Declaration
public string ExtractTextFromPages(IEnumerable<int> pageIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | pageIndexes | An IEnumerable list of page indexes. |
Returns
Type | Description |
---|---|
System.String | The text extracted from the PDF pages as a string. |
ExtractTextFromPages(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 Environment.NewLines
Declaration
public string ExtractTextFromPages(int startIndex, int endIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startIndex | The start page index. Note: Page 1 has index 0 |
System.Int32 | endIndex | The end page index. Note: The last page has index |
Returns
Type | Description |
---|---|
System.String | The text extracted from the PDF pages as a string. |
Finalize()
Finalizer
Declaration
protected override void Finalize()
Flatten(IEnumerable<Int32>)
Flattens a document (make the fields such as Forms Fields non-editable and non-accessible).
Declaration
public void Flatten(IEnumerable<int> Pages = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | Pages | Optional page indices to flatten (defaults to all pages) |
FromFile(String, String, String, ChangeTrackingModes)
Opens an existing PDF document for editing.
Adding a using declaration is not required. But can be used if you want to explicitly dispose. See: https://ironpdf.com/troubleshooting/ironpdf-using/
Declaration
public static PdfDocument FromFile(string PdfFilePath, string Password = "", string OwnerPassword = "", ChangeTrackingModes TrackChanges)
Parameters
Type | Name | Description |
---|---|---|
System.String | PdfFilePath | The PDF file path. |
System.String | Password | Optional user password if the PDF document is encrypted. |
System.String | OwnerPassword | Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..). |
ChangeTrackingModes | TrackChanges | Optionally track changes (for use with incremental saving) |
Returns
Type | Description |
---|---|
PdfDocument | An IronPdf.PdfDocument object as loaded from the file path. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | Exception thrown if can not be opened. |
System.ArgumentException |
|
FromUrl(Uri, String, String)
Opens a PDF stored on a URL for editing.
Adding a using declaration is not required. But can be used if you want to explicitly dispose. See: https://ironpdf.com/troubleshooting/ironpdf-using/
Declaration
public static PdfDocument FromUrl(Uri Uri, string Password = "", string OwnerPassword = "")
Parameters
Type | Name | Description |
---|---|---|
System.Uri | Uri | The URI to the PDF. |
System.String | Password | Optional user password if the PDF document is encrypted. |
System.String | OwnerPassword | Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..). |
Returns
Type | Description |
---|---|
PdfDocument | An IronPdf.PdfDocument object as loaded from the file path. |
Exceptions
Type | Condition |
---|---|
IronPdfProductException | Exception thrown if cannot read the PDF due to incorrect uri or password. |
GetAnnotations(Int32)
Retrieve a list of annotations from a given page index.
Declaration
public List<PdfAnnotation> GetAnnotations(int pageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | Index of the page for which to retrieve annotations. The index of the first page is 0. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<PdfAnnotation> | A list of annotations. |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
GetInstalledFonts()
Return a list of all fonts referenced in this document
Declaration
public List<FontInfo> GetInstalledFonts()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<FontInfo> | List of font info structure used in this document |
GetPageRotation(Int32)
Gets the rotation of a PDF page in degrees.
Declaration
public PdfPageRotation GetPageRotation(int PageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Index of the page to inspect. PageIndex is a 'Zero based' page number, the first page being 0. |
Returns
Type | Description |
---|---|
PdfPageRotation | Degrees of rotation |
GetPrintDocument(PrinterSettings, PrintController)
Returns a System.Drawing.Printing.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.
Note: 'GetPrintDocument(PrinterSettings, PrintController)' is only supported on: 'Windows'.
Printer settings. Note: If you create a new PrinterSettings() we recommend setting printerSettings.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); custom printController such as PreviewPrintController for a GUI print previewDeclaration
public PrintDocument GetPrintDocument(PrinterSettings printerSettings = null, PrintController printController = null)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Printing.PrinterSettings | printerSettings | |
System.Drawing.Printing.PrintController | printController |
Returns
Type | Description |
---|---|
System.Drawing.Printing.PrintDocument | A System.Drawing.Printing.PrintDocument. |
Exceptions
Type | Condition |
---|---|
System.Exception | IronPdf must be licensed to use this feature. |
GetRevision(Int32)
Creates a copy of this document at the specified revision number. See SaveAsRevision(String)
Declaration
public PdfDocument GetRevision(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Revision number. Revision 0 represents the original document, revision 1 is the first revision, etc. |
Returns
Type | Description |
---|---|
PdfDocument | A copy of the specified revision of this document |
GetVerifiedSignatures()
Returns a list of VerifiedSignature.
Declaration
public List<VerifiedSignature> GetVerifiedSignatures()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<VerifiedSignature> | list of VerifiedSignature |
IncrementReference()
Declaration
public void IncrementReference()
InsertPdf(PdfDocument, Int32)
Inserts another PDF into the current PdfDocument, starting at a given Page Index. If AnotherPdfFile contains form fields, those fields will be appended with '' in the resulting PDF. e.g. 'Name' will be 'Name'
Declaration
public PdfDocument InsertPdf(PdfDocument AnotherPdfFile, int AtIndex = 0)
Parameters
Type | Name | Description |
---|---|---|
PdfDocument | AnotherPdfFile | Another PdfDocument. |
System.Int32 | AtIndex | Index at which to insert the new content. Note: Page 1 has index 0... |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
Merge(PdfDocument, PdfDocument)
Static method that joins (concatenates) 2 PDF documents together into one PDF document. If the PDF contains form fields the form field in the resulting PDF's name will be appended with '_{index}' e.g. 'Name' will be 'Name_0'
Declaration
public static PdfDocument Merge(PdfDocument A, PdfDocument B)
Parameters
Type | Name | Description |
---|---|---|
PdfDocument | A | A PDF |
PdfDocument | B | A Seconds PDF |
Returns
Type | Description |
---|---|
PdfDocument | A new, merged PdfDocument |
Merge(IEnumerable<PdfDocument>)
Static method that joins (concatenates) multiple PDF documents together into one compiled PDF document. If the PDF contains form fields the form field in the resulting PDF's name will be appended with '_{index}' e.g. 'Name' will be 'Name_0'
Declaration
public static PdfDocument Merge(IEnumerable<PdfDocument> Documents)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<PdfDocument> | Documents | A IEnumerable of PdfDocument. To merge existing PDF files you may use the PdfDocument.FromFile static method in conjunction with Merge. |
Returns
Type | Description |
---|---|
PdfDocument | A new, merged PdfDocument |
PageToBitmap(Int32, Int32)
Renders a single page of the PDF to a IronSoftware.Drawing.AnyBitmap object.
Please add an assembly reference to IronSoftware.Drawing.AnyBitmap to use this "PDF To Image" method
Declaration
public AnyBitmap PageToBitmap(int pageIndex, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | The zero based page number to be converted to an image. E.g. Page 1 has a pageIndex of 0 |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
IronSoftware.Drawing.AnyBitmap | A IronSoftware.Drawing.AnyBitmap of the rendered PDF page. |
Remarks
The DPI
will be ignored under Linux and macOS.
PageToBitmap(Int32, Nullable<Int32>, Nullable<Int32>, Int32)
Renders a single page of the PDF to a IronSoftware.Drawing.AnyBitmap object.
Please add an assembly reference to IronSoftware.Drawing.AnyBitmap to use this "PDF To Image" method
Declaration
public AnyBitmap PageToBitmap(int pageIndex, Nullable<int> imageMaxWidth, Nullable<int> imageMaxHeight, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | The zero based page number to be converted to an image. E.g. Page 1 has a pageIndex of 0 |
System.Nullable<System.Int32> | imageMaxWidth | The target maximum width of the output images. |
System.Nullable<System.Int32> | imageMaxHeight | The target maximum height of the output images. |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
IronSoftware.Drawing.AnyBitmap | A IronSoftware.Drawing.AnyBitmap of the rendered PDF page. |
Remarks
The DPI
will be ignored under Linux and macOS.
PrependPdf(PdfDocument)
Adds another PDF to the beginning of the current PdfDocument If AnotherPdfFile contains form fields, those fields will be appended with '' in the resulting PDF. e.g. 'Name' will be 'Name'
Declaration
public PdfDocument PrependPdf(PdfDocument AnotherPdfFile)
Parameters
Type | Name | Description |
---|---|---|
PdfDocument | AnotherPdfFile | PdfDocument to prepend. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
Print()
Prints this PDF by sending it to the computer's printer.
For advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
if true print preview dialogs will be displayed to the user. Default value is false.Note: 'Print()' is only supported on: 'Windows'.
Declaration
public int Print()
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
Print(Boolean)
Declaration
public int Print(bool showPreview)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
Print(Int32)
Prints this PDF by sending it to the computer's printer.
For even more advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
Note: 'Print(Int32)' is only supported on: 'Windows'.
the horizontal and vertical PDF resolutions, in dots per inch. if-1
print with default
printer resolution. Default value is -1
.
Declaration
public int Print(int dpi)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
Print(Int32, Boolean)
Declaration
public int Print(int dpi, bool showPreview)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
Print(Int32, Int32, String, String, PrintController)
Prints this PDF by sending it to the computer's printer.
For even more advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
Note: 'Print(Int32, Int32, String, String, PrintController)' is only supported on: 'Windows'.
the horizontal PDF resolution, in dots per inch.the vertical PDF resolution, in dots per inch.the name of a printer, setnull or an empty string ("") to use default print. Default value is null.the file path, when printing to a file, setfilePath
. The default value is null. custom printController such as PreviewPrintController for a GUI print preview
Declaration
public int Print(int dpiX, int dpiY, string printerName = null, string filePath = null, PrintController customPrintController = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpiX | |
System.Int32 | dpiY | |
System.String | printerName | |
System.String | filePath | |
System.Drawing.Printing.PrintController | customPrintController |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
Print(Int32, String, String)
Prints this PDF by sending it to the computer's printer.
For even more advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
Note: 'Print(Int32, String, String)' is only supported on: 'Windows'.
the horizontal and vertical PDF resolutions, in dots per inch. if-1
print with default
printer resolution. Default value is -1
.the name of a printer, setnull or an empty string ("") to use default print. Default value is null.the file path, when printing to a file, set filePath
. The default value is null.
Declaration
public int Print(int dpi, string printerName = null, string filePath = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi | |
System.String | printerName | |
System.String | filePath |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
Print(Int32, String, String, Boolean)
Declaration
public int Print(int dpi, string printerName = null, string filePath = null, bool showPreview = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi | |
System.String | printerName | |
System.String | filePath | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
Print(String)
Prints this PDF by sending it to the computer's printer.
For even more advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
Note: 'Print(String)' is only supported on: 'Windows'.
the name of a printer, setnull or an empty string ("") to use default print. Default value is null.Declaration
public int Print(string printerName)
Parameters
Type | Name | Description |
---|---|---|
System.String | printerName |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
Print(String, Boolean)
Declaration
public int Print(string printerName, bool showPreview)
Parameters
Type | Name | Description |
---|---|---|
System.String | printerName | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
PrintToFile(Int32, String)
Prints this PDF by sending it to the computer's printer.
For advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
Note: 'PrintToFile(Int32, String)' is only supported on: 'Windows'.
the horizontal and vertical PDF resolutions, in dots per inch. if-1
print with default printer
resolution. Default value is -1
.output file path, if set to null or an empty string ("") default filePath will be random GUID.
Declaration
public int PrintToFile(int dpi, string filePath = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi | |
System.String | filePath |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
PrintToFile(Int32, String, Boolean)
Declaration
public int PrintToFile(int dpi, string filePath = null, bool showPreview = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi | |
System.String | filePath | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
PrintToFile(String)
Prints this PDF by sending it to the computer's printer.
For advanced real-world printing options please see overloads GetPrintDocument(PrinterSettings, PrintController).
Note: 'PrintToFile(String)' is only supported on: 'Windows'.
output file path, if set to null or an empty string ("") default filePath will be random GUID.Declaration
public int PrintToFile(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
PrintToFile(String, Boolean)
Declaration
public int PrintToFile(string filePath, bool showPreview = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
RasterizeToImageFiles(String, ImageType, Int32)
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
Declaration
public string[] RasterizeToImageFiles(string FileNamePattern, ImageType ImageFileType, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.png |
ImageType | ImageFileType | Type of the image file. If not specified, a best guess will be taken from the FileNamePattern file extension |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
RasterizeToImageFiles(String, IEnumerable<Int32>, ImageType, Int32)
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
Declaration
public string[] RasterizeToImageFiles(string FileNamePattern, IEnumerable<int> PageIndexes, ImageType ImageFileType, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.png |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | A list of the specific zero based page numbe to render as images. |
ImageType | ImageFileType | Type of the image file. If not specified, a best guess will be taken from the FileNamePattern file extension |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
RasterizeToImageFiles(String, IEnumerable<Int32>, Nullable<Int32>, Nullable<Int32>, ImageType, Int32)
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
Declaration
public string[] RasterizeToImageFiles(string FileNamePattern, IEnumerable<int> PageIndexes, Nullable<int> ImageMaxWidth, Nullable<int> ImageMaxHeight, ImageType ImageFileType, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.png |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | A list of the specific zero based page numbe to render as images. |
System.Nullable<System.Int32> | ImageMaxWidth | The target maximum width(in pixel) of the output images. |
System.Nullable<System.Int32> | ImageMaxHeight | The target maximum height(in pixel) of the output images. |
ImageType | ImageFileType | Type of the image file. If not specified, a best guess will be taken from the FileNamePattern file extension |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
RasterizeToImageFiles(String, Nullable<Int32>, Nullable<Int32>, ImageType, Int32)
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
Declaration
public string[] RasterizeToImageFiles(string FileNamePattern, Nullable<int> ImageMaxWidth, Nullable<int> ImageMaxHeight, ImageType ImageFileType, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.png |
System.Nullable<System.Int32> | ImageMaxWidth | The target maximum width(in pixel) of the output images. |
System.Nullable<System.Int32> | ImageMaxHeight | The target maximum height(in pixel) of the output images. |
ImageType | ImageFileType | Type of the image file. If not specified, a best guess will be taken from the FileNamePattern file extension |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
RemovePage(Int32)
Removes a page from the PDF at the given index.
Declaration
public PdfDocument RemovePage(int PageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Index of the page. Note: Page 1 has index 0... |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
RemovePages(IEnumerable<Int32>)
Removes a range of pages from the PDF
Declaration
public PdfDocument RemovePages(IEnumerable<int> PageIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | A list of pages indexes to remove. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
RemovePages(Int32, Int32)
Removes a range of pages from the PDF
Declaration
public PdfDocument RemovePages(int StartIndex, int EndIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | StartIndex | The start index. Note: Page 1 has index 0 |
System.Int32 | EndIndex | The end index. Note: The last page has index |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
RemoveSignatures()
Remove all digital signatures from the PDF document
Declaration
public void RemoveSignatures()
ReplaceTextOnAllPages(String, String)
Replace the specified old text with new text on all pages
Declaration
public void ReplaceTextOnAllPages(string oldText, string newText)
Parameters
Type | Name | Description |
---|---|---|
System.String | oldText | Old text to remove |
System.String | newText | New text to add |
ReplaceTextOnPage(Int32, String, String)
Replace the specified old text with new text on a given page
Declaration
public void ReplaceTextOnPage(int pageIndex, string oldText, string newText)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | pageIndex | Page index to search for old text to replace |
System.String | oldText | Old text to remove |
System.String | newText | New text to add |
ReplaceTextOnPages(Int32[], String, String)
Replace the specified old text with new text on specified pages
Declaration
public void ReplaceTextOnPages(int[] pageIndexes, string oldText, string newText)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | pageIndexes | Indexes if pages to search for old text to replace |
System.String | oldText | Old text to remove |
System.String | newText | New text to add |
Resize(Length, Length, IEnumerable<Int32>)
Resizes the PdfDocument to the specified width, height, and desired measurement unit. This will scale existing page contents to fit the new page dimensions, this may cause distortion in cases where Width-to-height ratio is different.
Declaration
public void Resize(Length PageWidth, Length PageHeight, IEnumerable<int> Pages = null)
Parameters
Type | Name | Description |
---|---|---|
Length | PageWidth | The width of the resized PdfDocument. |
Length | PageHeight | The height of the resized PdfDocument. |
System.Collections.Generic.IEnumerable<System.Int32> | Pages | The page(s) to resize, if not specified all pages will be resized |
Resize(PdfPaperSize, IEnumerable<Int32>)
Resizes the PDF document to the specified paper size.
Declaration
public void Resize(PdfPaperSize PdfPaperSize, IEnumerable<int> Pages = null)
Parameters
Type | Name | Description |
---|---|---|
PdfPaperSize | PdfPaperSize | The size to resize the PDF document to. |
System.Collections.Generic.IEnumerable<System.Int32> | Pages | The page(s) to resize, if not specified all pages will be resized |
Remarks
The available paper sizes are defined in the PdfPaperSize enumeration.
Resize(Double, Double, MeasurementUnit, IEnumerable<Int32>)
Resizes the PdfDocument to the specified width, height, and desired measurement unit. This will scale existing page contents to fit the new page dimensions, this may cause distortion in cases where Width-to-height ratio is different.
Declaration
public void Resize(double PageWidth, double PageHeight, MeasurementUnit MeasurementUnit, IEnumerable<int> Pages = null)
Parameters
Type | Name | Description |
---|---|---|
System.Double | PageWidth | The width of the resized PdfDocument. |
System.Double | PageHeight | The height of the resized PdfDocument. |
MeasurementUnit | MeasurementUnit | The measurement unit for the width and height values. |
System.Collections.Generic.IEnumerable<System.Int32> | Pages | The page(s) to resize, if not specified all pages will be resized |
ResizePage(Int32, Double, Double)
Resize a page to the specified dimensions (in millimeters)
Declaration
public void ResizePage(int PageIndex, double PageWidth, double PageHeight)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Page index to resize |
System.Double | PageWidth | Desired page width, in millimeters |
System.Double | PageHeight | Desired page height, in millimeters |
SaveAs(String, Boolean)
Saves the PdfDocument to a file.
Declaration
public PdfDocument SaveAs(string FileName, bool SaveAsRevision = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileName | Target file path |
System.Boolean | SaveAsRevision | Append changes to the end of the PDF rather than overwriting existing objects. See also SaveAsRevision(String) |
Returns
Type | Description |
---|---|
PdfDocument | This PdfDocument for fluid code notation; if SaveAsRevision is enabled, the returned PdfDocument will be a new revision |
SaveAsHtml(String, Boolean, String, IEnumerable<Int32>, HtmlFormatOptions)
Converts the PDF document to an HTML document and saves it to the provided file path with optional custom formatting.
Declaration
public void SaveAsHtml(string filePath, bool fullContentWidth = false, string title = "", IEnumerable<int> pageIndexes = null, HtmlFormatOptions htmlFormatOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | The file path where the HTML output will be saved. |
System.Boolean | fullContentWidth | If set to true, the pdf content in the HTML will be set to full width. |
System.String | title | Optional title to be used in the HTML output. If not provided, the title from PDF metadata will be used. |
System.Collections.Generic.IEnumerable<System.Int32> | pageIndexes | Optional set of page indexes to include in the HTML output. If not provided, all pages will be included. |
HtmlFormatOptions | htmlFormatOptions | Optional HTML formatting options. If not provided, default formatting will be used. |
SaveAsPdfA(String, PdfAVersions, String)
Saves the PdfDocument as a PDF/A Compliant PDF File
For more information see the: IronPDF PDFA How-To Guide
Note: All of non-embedded fonts are embedded as Helvetica Font which is one of 14 standard fonts provided by Adobe.
Declaration
public PdfDocument SaveAsPdfA(string FileName, PdfAVersions PdfAVersion, string CustomICC = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileName | Target file path |
PdfAVersions | PdfAVersion | (Optional) PDF-A standard format |
System.String | CustomICC | (Optional) Custom color profile file path |
Returns
Type | Description |
---|---|
PdfDocument | A PDF/A compliant reference to this document |
SaveAsPdfUA(String, PdfUAVersions)
Open a PDF File Path and saves a new PDF/UA Compliant PDF File to allow for Section 508 accessibility compliance. Please note that this feature supports PDF documents containing the English language only.
For more information see the: IronPDF PDF/UA How-To Guide
Note: All of non-embedded fonts are embedded as Helvetica Font which is one of 14 standard fonts provided by Adobe.
Declaration
public PdfDocument SaveAsPdfUA(string FileName, PdfUAVersions PdfUAVersion)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileName | Target file path |
PdfUAVersions | PdfUAVersion | Version of exported PDF/UA |
Returns
Type | Description |
---|---|
PdfDocument | A PDF/UA compliant reference to this document |
SaveAsRevision(String)
Saves current changes as a revision and returns the revised the document, optionally also saving the document to disk
Declaration
public PdfDocument SaveAsRevision(string FileName = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileName | Optional file path |
Returns
Type | Description |
---|---|
PdfDocument | The revised PdfDocument, ready for a new set of changes |
SaveAsSvg(String)
Converts the PDF document to an SVG format and saves it to the provided file path.
Declaration
public void SaveAsSvg(string fileNamePattern)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.svg |
SetAllPageRotations(PdfPageRotation)
Set rotation degree to all pages of the PdfDocument by a specified degree.
Declaration
public void SetAllPageRotations(PdfPageRotation Rotation)
Parameters
Type | Name | Description |
---|---|---|
PdfPageRotation | Rotation | Degrees of rotation |
SetPageRotation(Int32, PdfPageRotation)
Set rotation degree to one page of the PdfDocument by a specified degree.
Declaration
public void SetPageRotation(int PageIndex, PdfPageRotation Rotation)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Index of the page to rotate. PageIndex is a 'Zero based' page number, the first page being 0. |
PdfPageRotation | Rotation | Degrees of rotation |
SetPageRotations(IEnumerable<Int32>, PdfPageRotation)
Set rotation degree to selected pages of the PdfDocument by a specified degree.
Declaration
public void SetPageRotations(IEnumerable<int> PageIndexes, PdfPageRotation Rotation)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | Indexes of the pages to rotate in an IEnumerable, list or array. PageIndex is a 'Zero based' page number, the first page being 0. |
PdfPageRotation | Rotation | Degrees of rotation |
Sign(PdfSignature, SignaturePermissions)
Signs the PDF with digital signature with advanced options.
Note that the PDF will not be fully signed until Saved using SaveAs(String, Boolean), TrySaveAs(String), Stream or BinaryData. Multiple certificates may be used.
Declaration
public PdfDocument Sign(PdfSignature Signature, SignaturePermissions Permissions)
Parameters
Type | Name | Description |
---|---|---|
PdfSignature | Signature | The PdfSignature. |
SignaturePermissions | Permissions | Permissions regarding modifications to the document after the digital signature is applied |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
SignWithFile(String, String, String, SignaturePermissions)
Sign PDF with digital signature certificate. For more advanced options please see IronPdf.PdfDocument.SignPdfWithDigitalSignature(IronPdf.Signing.PdfSignature,IronPdf.Signing.SignaturePermissions)
Note that the PDF will not be fully signed until Saved using SaveAs(String, Boolean), TrySaveAs(String), Stream or BinaryData. Multiple certificates may be used.
Declaration
public PdfDocument SignWithFile(string CertificateFilePath, string Password, string TimeStampUrl = null, SignaturePermissions Permissions)
Parameters
Type | Name | Description |
---|---|---|
System.String | CertificateFilePath | The file path to a .pfx or .p12 digital signing certificate which may be generated using Adobe Acrobat Viewer. |
System.String | Password | The certificate password as a String. |
System.String | TimeStampUrl | Url to use for timestamping |
SignaturePermissions | Permissions | Permissions regarding modifications to the document after the digital signature is applied |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
See Also
SignWithStore(String, StoreLocation, SignaturePermissions)
Signs the PDF with digital signature extracted from your computer's signature storage.
Note that the PDF will not be fully signed until Saved using SaveAs(String, Boolean), TrySaveAs(String), Stream or BinaryData. Multiple certificates may be used.
Declaration
public PdfDocument SignWithStore(string Thumbprint, StoreLocation StoreLocation, SignaturePermissions Permissions)
Parameters
Type | Name | Description |
---|---|---|
System.String | Thumbprint | Thumbprint of a signature in your local computer's signature storage |
System.Security.Cryptography.X509Certificates.StoreLocation | StoreLocation | Computer storage location |
SignaturePermissions | Permissions | Permissions regarding modifications to the document after the digital signature is applied |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
ToBitmap(IEnumerable<Int32>, Int32)
Rasterizes (renders) the PDF into IronSoftware.Drawing.AnyBitmap objects.
Specific pages may be selected using the PageIndexes parameter.
Please add an assembly reference to IronSoftware.Drawing.AnyBitmap to use this "PDF To Image" method
Declaration
public AnyBitmap[] ToBitmap(IEnumerable<int> pageIndexes, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | pageIndexes | Specific zero based page index may be given to only convert part of the PDF document to images |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
IronSoftware.Drawing.AnyBitmap[] | An array of IronSoftware.Drawing.AnyBitmap image objects which can be saved, manipulated, displayed or edited programmatically. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToBitmap(Int32)
Rasterizes (renders) the PDF into IronSoftware.Drawing.AnyBitmap objects. 1 Bitmap for each page.
Please add an assembly reference to IronSoftware.Drawing.AnyBitmap to use this "PDF To Image" method.
Please Dispose() each Bitmap object after use.
Declaration
public AnyBitmap[] ToBitmap(int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | DPI | The resolution of the output Bitmap in 'Dots Per Inch'. Higher DPI creates larger bitmap files of higher image quality. |
Returns
Type | Description |
---|---|
IronSoftware.Drawing.AnyBitmap[] | An array of IronSoftware.Drawing.AnyBitmap image objects which can be saved, manipulated, displayed or edited programmatically. |
Remarks
The DPI
may be ignored on some Linux distros.
ToBitmap(Nullable<Int32>, Nullable<Int32>, IEnumerable<Int32>, Int32)
Rasterizes (renders) the PDF into IronSoftware.Drawing.AnyBitmap objects.
Specific pages may be selected using the PageIndexes parameter. The Widths and Height of the output images may be specified.
Please add an assembly reference to IronSoftware.Drawing.AnyBitmap to use this "PDF To Image" method
Declaration
public AnyBitmap[] ToBitmap(Nullable<int> imageMaxWidth, Nullable<int> imageMaxHeight, IEnumerable<int> pageIndexes = null, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Int32> | imageMaxWidth | The target maximum width(in pixel) of the output images. |
System.Nullable<System.Int32> | imageMaxHeight | The target maximum height(in pixel) of the output images. |
System.Collections.Generic.IEnumerable<System.Int32> | pageIndexes | Specific zero based page index may be given to only convert part of the PDF document to images |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
IronSoftware.Drawing.AnyBitmap[] | An array of IronSoftware.Drawing.AnyBitmap image objects which can be saved, manipulated, displayed or edited programmatically. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToHtmlString(Boolean, String, IEnumerable<Int32>, HtmlFormatOptions)
Converts the PDF document to an HTML string with optional custom formatting.
Declaration
public string ToHtmlString(bool fullContentWidth = false, string title = "", IEnumerable<int> pageIndexes = null, HtmlFormatOptions htmlFormatOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | fullContentWidth | If set to true, the pdf content in the HTML will be set to full width. |
System.String | title | Optional title to be used in the HTML output. If not provided, the title from PDF metadata will be used. |
System.Collections.Generic.IEnumerable<System.Int32> | pageIndexes | Optional set of page indexes to include in the HTML output. If not provided, all pages will be included. |
HtmlFormatOptions | htmlFormatOptions | Optional HTML formatting options. If not provided, default formatting will be used. |
Returns
Type | Description |
---|---|
System.String | An HTML string content representing the specified pages of the PDF document. |
ToJpegImages(String, IEnumerable<Int32>, Int32)
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
Declaration
public string[] ToJpegImages(string FileNamePattern, IEnumerable<int> PageIndexes, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpg |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | A list of the specific zero based page numbe to render as images. |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToJpegImages(String, IEnumerable<Int32>, Nullable<Int32>, Nullable<Int32>, Int32)
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
Declaration
public string[] ToJpegImages(string FileNamePattern, IEnumerable<int> PageIndexes, Nullable<int> ImageMaxWidth, Nullable<int> ImageMaxHeight, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpg |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | A list of the specific zero based page numbe to render as images. |
System.Nullable<System.Int32> | ImageMaxWidth | The target maximum width(in pixel) of the output images. |
System.Nullable<System.Int32> | ImageMaxHeight | The target maximum height(in pixel) of the output images. |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToJpegImages(String, Int32)
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
Declaration
public string[] ToJpegImages(string FileNamePattern, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpg |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToJpegImages(String, Nullable<Int32>, Nullable<Int32>, Int32)
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
Declaration
public string[] ToJpegImages(string FileNamePattern, Nullable<int> ImageMaxWidth, Nullable<int> ImageMaxHeight, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_page_*.jpg |
System.Nullable<System.Int32> | ImageMaxWidth | The target maximum width(in pixel) of the output images. |
System.Nullable<System.Int32> | ImageMaxHeight | The target maximum height(in pixel) of the output images. |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToMultiPageTiffImage(String, IEnumerable<Int32>, Int32)
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it 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
Declaration
public string ToMultiPageTiffImage(string FileName, IEnumerable<int> PageIndexes = null, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileName | A full file path for the output file. E.g. C:\images\pdf_pages.tiff |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | A list of the specific zero based page number to render |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String | A file path of the image file created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToMultiPageTiffImage(String, IEnumerable<Int32>, Nullable<Int32>, Nullable<Int32>, Int32)
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it 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
Declaration
public string[] ToMultiPageTiffImage(string FileName, IEnumerable<int> PageIndexes, Nullable<int> ImageMaxWidth, Nullable<int> ImageMaxHeight, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileName | A full file path for the output file. E.g. C:\images\pdf_pages.tiff |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | A list of the specific zero based page numbe to number to render |
System.Nullable<System.Int32> | ImageMaxWidth | The target maximum width(in pixel) of the output images. |
System.Nullable<System.Int32> | ImageMaxHeight | The target maximum height(in pixel) of the output images. |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToMultiPageTiffImage(String, Nullable<Int32>, Nullable<Int32>, Int32)
Renders the pages of the PDF as TIFF (Tagged Image File Format / Tif) file and saves it 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
Declaration
public string[] ToMultiPageTiffImage(string FileName, Nullable<int> ImageMaxWidth, Nullable<int> ImageMaxHeight, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileName | A full file path for the output file. E.g. C:\images\pdf_pages.tiff |
System.Nullable<System.Int32> | ImageMaxWidth | The target maximum width(in pixel) of the output images. |
System.Nullable<System.Int32> | ImageMaxHeight | The target maximum height(in pixel) of the output images. |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToPngImages(String, IEnumerable<Int32>, Int32)
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
Declaration
public string[] ToPngImages(string FileNamePattern, IEnumerable<int> PageIndexes, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.png |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | A list of the specific zero based page numbe to render as images. |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToPngImages(String, IEnumerable<Int32>, Nullable<Int32>, Nullable<Int32>, Int32)
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
Declaration
public string[] ToPngImages(string FileNamePattern, IEnumerable<int> PageIndexes, Nullable<int> ImageMaxWidth, Nullable<int> ImageMaxHeight, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.png |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | A list of the specific zero based page numbe to render |
System.Nullable<System.Int32> | ImageMaxWidth | The target maximum width(in pixel) of the output images. |
System.Nullable<System.Int32> | ImageMaxHeight | The target maximum height(in pixel) of the output images. |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToPngImages(String, Int32)
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
Declaration
public string[] ToPngImages(string FileNamePattern, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.png |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToPngImages(String, Nullable<Int32>, Nullable<Int32>, Int32)
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
Declaration
public string[] ToPngImages(string FileNamePattern, Nullable<int> ImageMaxWidth, Nullable<int> ImageMaxHeight, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.png |
System.Nullable<System.Int32> | ImageMaxWidth | The target maximum width(in pixel) of the output images. |
System.Nullable<System.Int32> | ImageMaxHeight | The target maximum height(in pixel) of the output images. |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToString()
Represent PDF document as a document id string
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
ToSvgString(Int32)
Converts a specific page of the PDF document to an SVG format and returns it as a string.
Declaration
public string ToSvgString(int page = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | page | The page number to be converted to SVG. Default is 0 (first page). |
Returns
Type | Description |
---|---|
System.String | The SVG representation of the specified page as a string. |
ToTiffImages(String, IEnumerable<Int32>, Int32)
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
Declaration
public string[] ToTiffImages(string FileNamePattern, IEnumerable<int> PageIndexes, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.tiff |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | A list of the specific zero based page number to render |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToTiffImages(String, IEnumerable<Int32>, Nullable<Int32>, Nullable<Int32>, Int32)
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
Declaration
public string[] ToTiffImages(string FileNamePattern, IEnumerable<int> PageIndexes, Nullable<int> ImageMaxWidth, Nullable<int> ImageMaxHeight, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.tiff |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | A list of the specific zero based page number to render |
System.Nullable<System.Int32> | ImageMaxWidth | The target maximum width(in pixel) of the output images. |
System.Nullable<System.Int32> | ImageMaxHeight | The target maximum height(in pixel) of the output images. |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToTiffImages(String, Int32)
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
Declaration
public string[] ToTiffImages(string FileNamePattern, int DPI)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.tiff |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
ToTiffImages(String, Nullable<Int32>, Nullable<Int32>, Int32)
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
Declaration
public string[] ToTiffImages(string FileNamePattern, Nullable<int> ImageMaxWidth, Nullable<int> ImageMaxHeight, int DPI = 96)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileNamePattern | A full or partial file path for the output files containing an asterisk. E.g. C:\images\pdf_pages_*.tiff |
System.Nullable<System.Int32> | ImageMaxWidth | The target maximum width(in pixel) of the output images. |
System.Nullable<System.Int32> | ImageMaxHeight | The target maximum height(in pixel) of the output images. |
System.Int32 | DPI | The desired resolution of the output Images. |
Returns
Type | Description |
---|---|
System.String[] | An array of the file paths of the image files created. |
Remarks
The DPI
will be ignored under Linux and macOS.
TrySaveAs(String)
Attempt to save the PdfDocument to a file.
Declaration
public bool TrySaveAs(string FileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileName | File Path |
Returns
Type | Description |
---|---|
System.Boolean | } |
VerifyPdfSignatures()
Verifies all the PDF signatures for this PDF document and returns true
if there are no invalid
signatures.
Declaration
public bool VerifyPdfSignatures()
Returns
Type | Description |
---|---|
System.Boolean |
|
VerifyPdfSignaturesInFile(String)
Verifies all the PDF signatures for a PDF file (by file path) and returns true
if there are no
invalid signatures.
Declaration
public static bool VerifyPdfSignaturesInFile(string PdfFilePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | PdfFilePath | The full or relative PDF file path. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Operators
Implicit(PdfDocumentId to PdfDocument)
Implicit conversion from PdfDocumentId to PdfDocument
Declaration
public static implicit operator PdfDocument(PdfDocumentId id)
Parameters
Type | Name | Description |
---|---|---|
IronSoftware.PdfDocumentId | id | PdfDocumentId to convert |
Returns
Type | Description |
---|---|
PdfDocument |