Class PdfDocument
Inheritance
Implements
Namespace: IronPdf
Assembly: IronPdf.dll
Syntax
public class PdfDocument : Object
Constructors
PdfDocument(Byte[], String, String)
Opens an existing PDF document for editing.
Declaration
public PdfDocument(byte[] PdfData, string Password = "", string OwnerPassword = "")
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..). |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | Exception thrown if can not be opened. |
PdfDocument(Byte[], String, String, Nullable<Boolean>)
Opens an existing PDF document for editing.
Declaration
public PdfDocument(byte[] PdfData, string Password, string OwnerPassword, Nullable<bool> GenerateUniqueDocumentIdentifiers)
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..). |
System.Nullable<System.Boolean> | GenerateUniqueDocumentIdentifiers |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | Exception thrown if can not be opened. |
PdfDocument(Stream, String, String)
Opens an existing PDF document for editing.
Declaration
public PdfDocument(Stream PdfDataStream, string Password = "", string OwnerPassword = "")
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..). |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | Exception thrown if can not be opened. |
PdfDocument(Stream, String, String, Nullable<Boolean>)
Opens an existing PDF document for editing.
Declaration
public PdfDocument(Stream PdfDataStream, string Password, string OwnerPassword, Nullable<bool> GenerateUniqueDocumentIdentifiers)
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..). |
System.Nullable<System.Boolean> | GenerateUniqueDocumentIdentifiers | if false, System.Guid is not generated inside PDF DOM and BinaryData for two identical PDF files will be the same. This is very useful for Unit Testing, especially comparing rendered PDFs for Equality. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | Exception thrown if can not be opened. |
PdfDocument(String, String, String)
Opens an existing PDF document for editing.
Declaration
public PdfDocument(string PdfFilePath, string Password = "", string OwnerPassword = "")
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..). |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | Exception thrown if can not be opened. |
System.ArgumentException |
|
PdfDocument(String, String, String, Nullable<Boolean>)
Opens an existing PDF document for editing.
Declaration
public PdfDocument(string PdfFilePath, string Password, string OwnerPassword, Nullable<bool> GenerateUniqueDocumentIdentifiers)
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..). |
System.Nullable<System.Boolean> | GenerateUniqueDocumentIdentifiers | if false, System.Guid is not generated inside PDF DOM and BinaryData for two identical PDF files will be the same. This is very useful for Unit Testing, especially comparing rendered PDFs for Equality. |
Exceptions
Type | Condition |
---|---|
System.IO.IOException | Exception thrown if can not be opened. |
System.ArgumentException |
|
Properties
Attachments
Collection of attachments contained within the pdf document
Declaration
public PdfAttachmentCollection Attachments { get; }
Property Value
Type | Description |
---|---|
PdfAttachmentCollection |
BinaryData
Gets the binary data for the full PDF file as a byte array.
Declaration
public byte[] BinaryData { get; }
Property Value
Type | Description |
---|---|
System.Byte[] | The PDF file as a byte array. |
BookMarks
An PdfOutline object allowing developers to add, edit and remove navigational bookmarks from PDF documents.
Declaration
public PdfOutline BookMarks { get; }
Property Value
Type | Description |
---|---|
PdfOutline |
Form
Gets an object returning any PDF editable form fields which can have their values both read and set programmatically.
Declaration
public PdfForm Form { get; }
Property Value
Type | Description |
---|---|
PdfForm | The form. |
GenerateUniqueDocumentIdentifiers
if false, System.Guid is not generated inside PDF DOM (better for unit testing) and BinaryData of two identical PDF files is the same.
If true, System.Guid is generated inside PDF DOM (better for security) and BinaryData of two identical PDF files differs.
Default value is false.
Declaration
public bool GenerateUniqueDocumentIdentifiers { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
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 |
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>)
Renders HTML page footers to an existing PDF File
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. |
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>)
Renders HTML page footers to an existing PDF File
Margin spacing on the PDF page for the footer are set to default values of 25mm. An overload method allow footer margins to be chosen specifically or set to zero.
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. |
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>)
Renders HTML page headers to an existing PDF File
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. |
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>)
Renders HTML page headers to an existing PDF File
Margin spacing on the PDF page for the header are set to default values of 25mm. An overload method allow header margins to be chosen specifically or set to zero.
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. |
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>)
Add HTML headers and footers 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 |
AddTextAnnotation(TextAnnotation, Int32, Int32, Int32, Int32, Int32)
Adds an annotation to a page of this PdfDocument
Declaration
public void AddTextAnnotation(TextAnnotation TextAnnotation, int PageIndex, int X, int Y, int Width = 30, int Height = 30)
Parameters
Type | Name | Description |
---|---|---|
TextAnnotation | TextAnnotation | The annotation as a IronPdf.PdfDocument.TextAnnotation object. |
System.Int32 | PageIndex | Index of the page to add the annotation. The first page has a PageIndex of 0 |
System.Int32 | X | The horizontal X position of the annotation on your page in pixels |
System.Int32 | Y | The vertical Y position of the annotation on your page in pixels. Measured from top downwards. |
System.Int32 | Width | The width of your annotation's icon and interactive area in pixels |
System.Int32 | Height | The height of your annotation's icon and interactive area in pixels |
AddTextAnnotation(String, String, String, Int32, Int32, Int32, Int32, Int32, TextAnnotation.AnnotationIcon, Boolean, Boolean, Boolean, String, Double)
Adds an annotation to a page of this PdfDocument
Declaration
public void AddTextAnnotation(string Title, string Subject, string Contents, int PageIndex, int X, int Y, int Width = 30, int Height = 30, TextAnnotation.AnnotationIcon Icon, bool Open = true, bool ReadOnly = true, bool Printable = false, string RgbColor = "#FFFF33", double Opacity = 1)
Parameters
Type | Name | Description |
---|---|---|
System.String | Title | The title of the annotation |
System.String | Subject | The subject or 'subheading' of the annotation |
System.String | Contents | The text content of the annotation |
System.Int32 | PageIndex | Index of the page to add the annotation. The first page has a PageIndex of 0 |
System.Int32 | X | The horizontal X position of the annotation on your page in pixels |
System.Int32 | Y | The vertical Y position of the annotation on your page in pixels. Measured from top downwards. |
System.Int32 | Width | The width of your annotation's icon and interactive area in pixels |
System.Int32 | Height | The height of your annotation's icon and interactive area in pixels |
TextAnnotation.AnnotationIcon | Icon | The icon used to display the interactive annotation within the PDF |
System.Boolean | Open | Sets the annotation to be opened and readable by default, without user interaction |
System.Boolean | ReadOnly | Makes the annotation non user editable |
System.Boolean | Printable | Makes the annotation render during user PDF printing operations |
System.String | RgbColor | Color of the annotation's background 'sticky note' using Html color notation. E.g. '#FFFF33'. |
System.Double | Opacity | The opacity of the annotation (valid values are from 0.0 to 1.0) |
AddTextFooters(TextHeaderFooter, Double, Double, Double, Int32, IEnumerable<Int32>)
Renders page footers to an existing PDF File
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. |
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>)
Renders page footers to an existing PDF File
Margin spacing on the PDF page for the footer are set to default values of 25mm. An overload method allow footer margins to be chosen specifically or set to zero.
Declaration
public PdfDocument AddTextFooters(TextHeaderFooter Footer, 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.Int32 | FirstPageNumber | Optional. The number of first page. |
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>)
Renders page headers to an existing PDF File
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. |
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>)
Renders page headers to an existing PDF File
Margin spacing on the PDF page for the header are set to default values of 25mm. An overload method allow header margins to be chosen specifically or set to zero.
Declaration
public PdfDocument AddTextHeaders(TextHeaderFooter Header, 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.Int32 | FirstPageNumber | Optional. The number of first page. |
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>)
Add text headers and footers 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 |
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()
ExtractAllBitmaps()
Finds all embedded Images from within the PDF and returns then as System.Drawing.Bitmap objects
Declaration
public IEnumerable<Bitmap> ExtractAllBitmaps()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Drawing.Bitmap> | IEnumerable of Bitmap. The extracted images as System.Drawing Objects |
ExtractAllImages()
Finds all embedded Images from within the PDF and returns then as System.Drawing.Image objects
Declaration
public IEnumerable<Image> ExtractAllImages()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Drawing.Image> | IEnumerable of Image. The extracted images as System.Drawing Objects |
ExtractAllRawImages()
Extracts all images from a PDf document. Images are returned as their raw data in as Byte Arrays (byte[])
Declaration
public IEnumerable<byte[]> ExtractAllRawImages()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<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 System.Drawing.Bitmap objects
Declaration
public IEnumerable<Bitmap> 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.IEnumerable<System.Drawing.Bitmap> | IEnumerable of Bitmap. The extracted images as System.Drawing Objects |
ExtractBitmapsFromPages(IEnumerable<Int32>)
Finds all embedded Images from within a specified pages in the PDF and returns them as System.Drawing.Bitmap objects
Declaration
public IEnumerable<Bitmap> 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.IEnumerable<System.Drawing.Bitmap> | IEnumerable of Bitmap. The extracted images as System.Drawing Objects |
ExtractBitmapsFromPages(Int32, Int32)
Finds all embedded Images from within a range of pages in the PDF and returns them as System.Drawing.Bitmap objects
Declaration
public IEnumerable<Bitmap> 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.IEnumerable<System.Drawing.Bitmap> | IEnumerable of Bitmap. The extracted images as System.Drawing Objects |
ExtractImagesFromPage(Int32)
Finds all embedded Images from within one page of the PDF and returns them as System.Drawing.Image objects
Declaration
public IEnumerable<Image> 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.IEnumerable<System.Drawing.Image> | IEnumerable of Image. The extracted images as System.Drawing Objects |
ExtractImagesFromPages(IEnumerable<Int32>)
Finds all embedded Images from within a specified pages in the PDF and returns them as System.Drawing.Image objects
Declaration
public IEnumerable<Image> 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.IEnumerable<System.Drawing.Image> | IEnumerable of Image. The extracted images as System.Drawing Objects |
ExtractImagesFromPages(Int32, Int32)
Finds all embedded Images from within a range of pages in the PDF and returns them as System.Drawing.Bitmap objects
Declaration
public IEnumerable<Image> 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.IEnumerable<System.Drawing.Image> | IEnumerable of Image. The extracted images as System.Drawing 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 IEnumerable<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.IEnumerable<System.Byte[]> | IEnumerable of raw image byte array. |
ExtractRawImagesFromPages(IEnumerable<Int32>)
Finds all embedded Images from specified pages in the PDF and returns them as System.Drawing.Image objects
Declaration
public IEnumerable<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.IEnumerable<System.Byte[]> | IEnumerable 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 IEnumerable<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.IEnumerable<System.Byte[]> | IEnumerable 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 non-editable).
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)
Opens an existing PDF document for editing.
Declaration
public static PdfDocument FromFile(string PdfFilePath, string password = "", string ownerPassword = "")
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..). |
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 |
|
GetPageRotation(Int32)
Gets the rotation of a PDF page in degrees.
Declaration
public RenderRotations 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 |
---|---|
RenderRotations | Degrees of rotation |
GetPrintDocument()
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.
Declaration
public PrintDocument GetPrintDocument()
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. |
GetVerifiedSignatures()
Returns a list of IronPdf.VerifiedSignature.
Declaration
public ICollection<VerifiedSignature> GetVerifiedSignatures()
Returns
Type | Description |
---|---|
System.Collections.Generic.ICollection<VerifiedSignature> | list of IronPdf.VerifiedSignature |
GetVerifiedSignatures(Byte[])
Returns a list of IronPdf.VerifiedSignature from the specified PDF document by the parameter data
.
Declaration
public static ICollection<VerifiedSignature> GetVerifiedSignatures(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | the bytes of a pdf document |
Returns
Type | Description |
---|---|
System.Collections.Generic.ICollection<VerifiedSignature> | list of IronPdf.VerifiedSignature |
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> pdfs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<PdfDocument> | pdfs | 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 System.Drawing.Bitmap object.
Please add an assembly reference to System.Drawing to use this "PDF To Image" method
Please Dispose() each Bitmap object after use.
Declaration
public Bitmap 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 |
---|---|
System.Drawing.Bitmap | A System.Drawing.Bitmap 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 System.Drawing.Bitmap object.
Please add an assembly reference to System.Drawing to use this "PDF To Image" method
Please Dispose() each Bitmap object after use.
Declaration
public Bitmap 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 |
---|---|
System.Drawing.Bitmap | A System.Drawing.Bitmap 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(Boolean)
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().
if true print preview dialogs will be displayed to the user. Default value is false.Declaration
public int Print(bool showPreview = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
Print(Int32, Boolean)
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().
if true print preview dialogs will be displayed to the user. Default value is false.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, bool showPreview = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
Print(Int32, Int32, String, String, Boolean)
Prints this PDF by sending it to the computer's printer.
For advanced real-world printing options please see GetPrintDocument().
the horizontal PDF resolution, in dots per inch.the vertical PDF resolution, in dots per inch.the name of a printer, set null or an empty string ("") to use default print. The default value is null.the file path, when printing to a file, set null or an empty string ("") for printing output is sent to a port instead of thefilePath
. The default value is null.if true print preview dialogs will be displayed to the user. The
default value is false.
Declaration
public int Print(int dpiX, int dpiY, string printerName = null, string filePath = null, bool showPreview = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpiX | |
System.Int32 | dpiY | |
System.String | printerName | |
System.String | filePath | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
Print(Int32, String, String, Boolean)
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().
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 null or an empty string ("") for printing output is sent to a port instead of the filePath
. The default value is null.if true print preview dialogs will be displayed to the user. Default value is false.
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 | The number of printed pages. |
See Also
Print(String, Boolean)
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().
the name of a printer, set null or an empty string ("") to use default print. Default value is null.if true print preview dialogs will be displayed to the user. Default value is false.Declaration
public int Print(string printerName, bool showPreview = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | printerName | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
PrintToFile(Int32, String, Boolean)
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().
the horizontal and vertical PDF resolutions, in dots per inch. if-1
print with default printer
resolution. Default value is -1
.the file path, when printing to a
file, set null or an empty string ("") for printing output is sent to a port instead of
the filePath
. The default value is null.if true print preview dialogs will be displayed to the user. Default
value is false.
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 | The number of printed pages. |
See Also
PrintToFile(String, Boolean)
Prints this PDF by sending it to the computer's printer.
For advanced real-world printing options please see overloads GetPrintDocument().
the file path, when printing to a file, set null or an empty string ("") for printing output is sent to a port instead of thefilePath
. The default value is null.if true print preview dialogs will be displayed to the user. Default
value is false.
Declaration
public int PrintToFile(string filePath, bool showPreview = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
See Also
QuickSignPdfWithDigitalSignatureFile(String, String)
Sign PDF with digital signature certificate. For more advanced options please see QuickSignPdfWithDigitalSignatureFile(String, String)
Note that the PDF will not be fully signed until Saved using SaveAs(String), TrySaveAs(String), Stream or BinaryData. Multiple certificates may be used.
Declaration
public PdfDocument QuickSignPdfWithDigitalSignatureFile(string CertificateFilePath, string Password)
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. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
See Also
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 |
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 repalce |
System.String | oldText | Old text to remove |
System.String | newText | New text to add |
RotateAllPages(RenderRotations)
Rotates all pages of the PdfDocument by a specified number of degrees.
Declaration
public void RotateAllPages(RenderRotations Rotation)
Parameters
Type | Name | Description |
---|---|---|
RenderRotations | Rotation | Degrees of rotation |
RotatePage(Int32, RenderRotations)
Rotates one page of the PdfDocument by a specified number of degrees.
Declaration
public void RotatePage(int PageIndex, RenderRotations 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. |
RenderRotations | Rotation | Degrees of rotation |
RotateSelectedPages(IEnumerable<Int32>, RenderRotations)
Rotates selected pages of the PdfDocument by a specified number of degrees.
Declaration
public void RotateSelectedPages(IEnumerable<int> PageIndexes, RenderRotations 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. |
RenderRotations | Rotation | Degrees of rotation |
SaveAs(String)
Saves the PdfDocument to a file.
Supports site relative paths staring with "~/" in .Net Framework Web 4+ Applications
Declaration
public PdfDocument SaveAs(string FileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileName | File Path |
Returns
Type | Description |
---|---|
PdfDocument | This PdfDocument for fluid code notation. |
SignPdfWithDigitalSignature(PdfSignature)
Signs the PDF with digital signature with advanced options.
Note that the PDF will not be fully signed until Saved using SaveAs(String), TrySaveAs(String), Stream or BinaryData. Multiple certificates may be used.
Declaration
public PdfDocument SignPdfWithDigitalSignature(PdfSignature Signature)
Parameters
Type | Name | Description |
---|---|---|
PdfSignature | Signature | The PdfSignature. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
StampHTML(HtmlStamp, ChromePdfRenderOptions)
Edits the PDF by adding rendered HTML either behind or in-front of the existing contents of every page.
Declaration
public PdfDocument StampHTML(HtmlStamp Stamp, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
HtmlStamp | Stamp | The HtmlStamp stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
StampHTML(HtmlStamp, IEnumerable<Int32>, ChromePdfRenderOptions)
Edits the PDF by adding rendered HTML either behind or in-front of the existing contents of specified pages.
Declaration
public PdfDocument StampHTML(HtmlStamp Stamp, IEnumerable<int> PageIndexesToStamp, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
HtmlStamp | Stamp | The IronPdf.HtmlStamp stamp. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The list page indexes (zero-based page number) to stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
StampHTML(HtmlStamp, Int32, ChromePdfRenderOptions)
Edits the PDF by adding rendered HTML either behind or in-front of the existing contents of one page.
Declaration
public PdfDocument StampHTML(HtmlStamp Stamp, int PageIndexToStamp, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
HtmlStamp | Stamp | The IronPdf.HtmlStamp stamp. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
StampHTMLAsync(HtmlStamp, ChromePdfRenderOptions)
Asynchronously edits the PDF by adding rendered HTML either behind or in-front of the existing contents of every page.
Declaration
public Task<PdfDocument> StampHTMLAsync(HtmlStamp Stamp, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
HtmlStamp | Stamp | The HtmlStamp stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
Remarks
Please wait for the task to be completed before saving to file!
StampHTMLAsync(HtmlStamp, IEnumerable<Int32>, ChromePdfRenderOptions)
Asynchronously edits the PDF by adding rendered HTML either behind or in-front of the existing contents of specified pages.
Declaration
public Task<PdfDocument> StampHTMLAsync(HtmlStamp Stamp, IEnumerable<int> PageIndexesToStamp, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
HtmlStamp | Stamp | The IronPdf.HtmlStamp stamp. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The list page indexes (zero-based page number) to stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
Remarks
Please wait for the task to be completed before saving to file!
StampHTMLAsync(HtmlStamp, Int32, ChromePdfRenderOptions)
Asynchronously edits the PDF by adding rendered HTML either behind or in-front of the existing contents of one page.
Declaration
public Task<PdfDocument> StampHTMLAsync(HtmlStamp Stamp, int PageIndexToStamp, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
HtmlStamp | Stamp | The IronPdf.HtmlStamp stamp. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
Remarks
Please wait for the task to be completed before saving to file!
StampHTMLRange(IEnumerable<HtmlStamp>, ChromePdfRenderOptions)
Edits the PDF by adding rendered HTML(s) either behind or in-front of the existing contents of specified pages.
Declaration
public PdfDocument StampHTMLRange(IEnumerable<HtmlStamp> Stamps, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<HtmlStamp> | Stamps | The list of IronPdf.HtmlStamp stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
StampHTMLRange(IEnumerable<HtmlStamp>, IEnumerable<Int32>, ChromePdfRenderOptions)
Edits the PDF by adding rendered HTML(s) either behind or in-front of the existing contents of specified pages.
Declaration
public PdfDocument StampHTMLRange(IEnumerable<HtmlStamp> Stamps, IEnumerable<int> PageIndexesToStamp, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<HtmlStamp> | Stamps | The list of IronPdf.HtmlStamp stamp. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The list page indexes (zero-based page number) to stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
StampHTMLRange(IEnumerable<HtmlStamp>, Int32, ChromePdfRenderOptions)
Edits the PDF by adding rendered HTML(s) either behind or in-front of the existing contents of specified pages.
Declaration
public PdfDocument StampHTMLRange(IEnumerable<HtmlStamp> Stamps, int PageIndexToStamp, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<HtmlStamp> | Stamps | The list of IronPdf.HtmlStamp stamp. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
StampHTMLRangeAsync(IEnumerable<HtmlStamp>, ChromePdfRenderOptions)
Asynchronously edit the PDF by adding rendered HTML(s) either behind or in-front of the existing contents of specified pages. This method will grouping up stamps before process, This should be faster but the result may diffrent from normal StampHTML(HtmlStamp, ChromePdfRenderOptions)
Declaration
public Task<PdfDocument> StampHTMLRangeAsync(IEnumerable<HtmlStamp> Stamps, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<HtmlStamp> | Stamps | The list of IronPdf.HtmlStamp stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
StampHTMLRangeAsync(IEnumerable<HtmlStamp>, IEnumerable<Int32>, ChromePdfRenderOptions)
Asynchronously edits the PDF by adding rendered HTML(s) either behind or in-front of the existing contents of specified pages. This method will grouping up stamps before process, This should be faster but the result may diffrent from normal StampHTML(HtmlStamp, ChromePdfRenderOptions)
Declaration
public Task<PdfDocument> StampHTMLRangeAsync(IEnumerable<HtmlStamp> Stamps, IEnumerable<int> PageIndexesToStamp, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<HtmlStamp> | Stamps | The list of IronPdf.HtmlStamp stamp. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The list page indexes (zero-based page number) to stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
StampHTMLRangeAsync(IEnumerable<HtmlStamp>, Int32, ChromePdfRenderOptions)
Asynchronously edit the PDF by adding rendered HTML(s) either behind or in-front of the existing contents of specified pages. This method will grouping up stamps before process, This should be faster but the result may diffrent from normal StampHTML(HtmlStamp, ChromePdfRenderOptions)
Declaration
public Task<PdfDocument> StampHTMLRangeAsync(IEnumerable<HtmlStamp> Stamps, int PageIndexToStamp, ChromePdfRenderOptions RenderOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<HtmlStamp> | Stamps | The list of IronPdf.HtmlStamp stamp. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to stamp. |
ChromePdfRenderOptions | RenderOptions | Rendering options. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<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 System.Drawing.Bitmap objects.
Specific pages may be selected using the PageIndexes parameter.
Please add an assembly reference to System.Drawing to use this "PDF To Image" method
Please Dispose() each Bitmap object after use.
Declaration
public Bitmap[] 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 |
---|---|
System.Drawing.Bitmap[] | An array of System.Drawing.Bitmap 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 System.Drawing.Bitmap objects. 1 Bitmap for each page.
Please add an assembly reference to System.Drawing to use this "PDF To Image" method.
Please Dispose() each Bitmap object after use.
Declaration
public Bitmap[] 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 |
---|---|
System.Drawing.Bitmap[] | An array of System.Drawing.Bitmap 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 System.Drawing.Bitmap 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 System.Drawing to use this "PDF To Image" method
Please Dispose() each Bitmap object after use.
Declaration
public Bitmap[] 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 |
---|---|
System.Drawing.Bitmap[] | An array of System.Drawing.Bitmap image objects which can be saved, manipulated, displayed or edited programmatically. |
Remarks
The DPI
will be ignored under Linux and macOS.
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, 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[] | 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>, 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, 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, int DPI)
Parameters
Type | Name | Description |
---|---|---|
System.String | FileName | A full file path for the output file. 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.
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.
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 |
|
WatermarkAllPages(String, WaterMarkLocation, Int32, Int32, String)
Watermarks all pages of this PDF with HTML content.
Watermarks are restricted to basic positioning and a 100mm by 100mm maximum size.
Declaration
public PdfDocument WatermarkAllPages(string Html, WaterMarkLocation Location, int Opacity = 100, int Rotation = 0, string Hyperlink = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | Html | The HTML fragment |
WaterMarkLocation | Location | The location of the watermark. IronPdf.PdfDocument.WaterMarkLocation |
System.Int32 | Opacity | The opacity of the watermark from 0-100%. 100 is opaque, 0 is invisible. |
System.Int32 | Rotation | The rotation of the watermark content in clockwise degrees. |
System.String | Hyperlink | An optional hyperlink which the watermark will link to. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
WatermarkPage(String, Int32, WaterMarkLocation, Int32, Int32, String)
Watermarks a single page of this PDF with HTML content.
Watermarks are restricted to basic positioning and a 100mm by 100mm maximum size.
Declaration
public PdfDocument WatermarkPage(string Html, int PageIndexToWaterMark, WaterMarkLocation Location, int Opacity = 100, int Rotation = 0, string Hyperlink = "")
Parameters
Type | Name | Description |
---|---|---|
System.String | Html | The HTML fragment |
System.Int32 | PageIndexToWaterMark | The page index (zero-based page number) of this PDF to watermark. |
WaterMarkLocation | Location | The location of the watermark. IronPdf.PdfDocument.WaterMarkLocation |
System.Int32 | Opacity | The opacity of the watermark from 0-100%. 100 is opaque, 0 is invisible. |
System.Int32 | Rotation | The rotation of the watermark content in clockwise degrees. |
System.String | Hyperlink | An optional hyperlink which the watermark will link to. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |
WatermarkPages(String, IEnumerable<Int32>, WaterMarkLocation, Int32, Int32, String, WaterMarkPositioning)
Watermarks all pages of this PDF with HTML content.
Watermarks are restricted to basic positioning and a 100mm by 100mm maximum size.
Declaration
public PdfDocument WatermarkPages(string Html, IEnumerable<int> PageIndexesToWaterMark, WaterMarkLocation Location, int Opacity = 100, int Rotation = 0, string Hyperlink = "", WaterMarkPositioning positionOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | Html | The HTML fragment |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToWaterMark | A list of page index (zero-based page number) of this PDF to watermark. |
WaterMarkLocation | Location | The location of the watermark. WaterMarkLocation |
System.Int32 | Opacity | The opacity of the watermark from 0-100%. 100 is opaque, 0 is invisible. |
System.Int32 | Rotation | The rotation of the watermark content in clockwise degrees. |
System.String | Hyperlink | An optional hyperlink which the watermark will link to. |
WaterMarkPositioning | positionOptions | Additional options for positioning the watermark on the page |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument object, allowing for a 'fluent' (LINQ like) chained in-line code style |