Class PdfDocument
Inheritance
Implements
Namespace: IronPdf
Assembly: IronPdf.dll
Syntax
public class PdfDocument : Object
Constructors
PdfDocument(PdfDocument)
Declaration
public PdfDocument(PdfDocument previous)
Parameters
Type | Name | Description |
---|---|---|
PdfDocument | previous |
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(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(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(Uri, String, String)
Opens an existing PDF document from the specified Uri for editing.
Declaration
public PdfDocument(Uri PdfUri, string Password = "", string OwnerPassword = "")
Parameters
Type | Name | Description |
---|---|---|
System.Uri | PdfUri | The Uri to the PDF. |
System.String | Password | Optional user password if the PDF document is encrypted. |
System.String | OwnerPassword | Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..). |
Exceptions
Type | Condition |
---|---|
IronPdfProductException | Exception thrown if PDF cannot be found at URI or if password is incorrect. |
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
Hierarchy of navigational bookmarks contained at the top level of the document
Declaration
public PdfBookMarkCollection Bookmarks { get; }
Property Value
Type | Description |
---|---|
PdfBookMarkCollection |
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. |
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 spacings are set to default values of 25mm. Use AddHtmlFooters(HtmlHeaderFooter, Double, Double, Double, Int32, IEnumerable<Int32>) to specify footer margins
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 spacings are set to default values of 25mm. Use AddHtmlHeaders(HtmlHeaderFooter, Double, Double, Double, Int32, IEnumerable<Int32>) to specify header margins
Declaration
public PdfDocument AddHtmlHeaders(HtmlHeaderFooter Header, int FirstPageNumber = 1, IEnumerable<int> PageIndexesToAddHeadersTo = null)
Parameters
Type | Name | Description |
---|---|---|
HtmlHeaderFooter | Header | A new instance of IronPdf.HtmlHeaderFooter that defines the header content and layout. |
System.Int32 | FirstPageNumber | Optional. The number of first page. |
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 bottom upwards. |
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 bottom upwards. |
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 |
ApplyMultipleStamps(IEnumerable<Stamper>)
Declaration
public PdfDocument ApplyMultipleStamps(IEnumerable<Stamper> Stampers)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Stamper> | Stampers | A list of Stamper objects, each with their own HTML stamp, to all be stamped onto the PDF. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyMultipleStamps(IEnumerable<Stamper>, IEnumerable<Int32>)
Declaration
public PdfDocument ApplyMultipleStamps(IEnumerable<Stamper> Stampers, IEnumerable<int> PageIndexesToStamp)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Stamper> | Stampers | A list of Stamper objects, each with their own HTML stamp, to all be stamped onto the PDF. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The page indexes (zero-based page number) to apply the stamps to. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyMultipleStamps(IEnumerable<Stamper>, Int32)
Declaration
public PdfDocument ApplyMultipleStamps(IEnumerable<Stamper> Stampers, int PageIndexToStamp)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Stamper> | Stampers | A list of Stamper objects, each with their own HTML stamp, to all be stamped onto the PDF. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to apply the stamps to. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyMultipleStampsAsync(IEnumerable<Stamper>)
Declaration
public Task<PdfDocument> ApplyMultipleStampsAsync(IEnumerable<Stamper> Stampers)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Stamper> | Stampers | A list of Stamper objects, each with their own HTML stamp, to all be stamped onto the PDF. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyMultipleStampsAsync(IEnumerable<Stamper>, IEnumerable<Int32>)
Declaration
public Task<PdfDocument> ApplyMultipleStampsAsync(IEnumerable<Stamper> Stampers, IEnumerable<int> PageIndexesToStamp)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Stamper> | Stampers | A list of Stamper objects, each with their own HTML stamp, to all be stamped onto the PDF. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The page indexes (zero-based page number) to apply the stamps to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyMultipleStampsAsync(IEnumerable<Stamper>, Int32)
Declaration
public Task<PdfDocument> ApplyMultipleStampsAsync(IEnumerable<Stamper> Stampers, int PageIndexToStamp)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<Stamper> | Stampers | A list of Stamper objects, each with their own HTML stamp, to all be stamped onto the PDF. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to apply the stamps to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyStamp(Stamper)
Declaration
public PdfDocument ApplyStamp(Stamper Stamper)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyStamp(Stamper, IEnumerable<Int32>)
Declaration
public PdfDocument ApplyStamp(Stamper Stamper, IEnumerable<int> PageIndexesToStamp)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The list of page indexes (zero-based page number) to apply the stamp to. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyStamp(Stamper, Int32)
Declaration
public PdfDocument ApplyStamp(Stamper Stamper, int PageIndexToStamp)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to apply the stamp to. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
ApplyStampAsync(Stamper)
Declaration
public Task<PdfDocument> ApplyStampAsync(Stamper Stamper)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
Remarks
Please wait for the task to be completed before saving to file!
ApplyStampAsync(Stamper, IEnumerable<Int32>)
Declaration
public Task<PdfDocument> ApplyStampAsync(Stamper Stamper, IEnumerable<int> PageIndexesToStamp)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexesToStamp | The page indexes (zero-based page number) to apply the stamps to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
Remarks
Please wait for the task to be completed before saving to file!
ApplyStampAsync(Stamper, Int32)
Declaration
public Task<PdfDocument> ApplyStampAsync(Stamper Stamper, int PageIndexToStamp)
Parameters
Type | Name | Description |
---|---|---|
Stamper | Stamper | The Stamper object that has the HTML to be stamped onto the PDF. |
System.Int32 | PageIndexToStamp | The page index (zero-based page number) to apply the stamp to. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PdfDocument> | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
Remarks
Please wait for the task to be completed before saving to file!
ApplyWatermark(String, Int32, VerticalAlignment, HorizontalAlignment)
Adds Watermark to PDF, Please use ApplyStamp(Stamper) for more control.
Declaration
public PdfDocument ApplyWatermark(string html, int opacity = 50, VerticalAlignment verticalAlignment, HorizontalAlignment horizontalAlignment)
Parameters
Type | Name | Description |
---|---|---|
System.String | html | The HTML fragment which will be stamped onto your PDF. |
System.Int32 | opacity | Watermark transparent value. 0 is invisible, 100 if fully opaque. |
VerticalAlignment | verticalAlignment | The vertical alignment of the watermark relative to the page. |
HorizontalAlignment | horizontalAlignment | The horizontal alignment of the watermark relative to the page. |
Returns
Type | Description |
---|---|
PdfDocument | Returns this PdfDocument, allowing for a 'fluent' (LINQ like) chained in-line code style |
CompressImages(Int32, Boolean)
Compress existing images using JPG encoding and the specified settings
Declaration
public void CompressImages(int Quality, bool ScaleToVisibleSize = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | Quality | Quality (1 - 100) to use during compression |
System.Boolean | ScaleToVisibleSize | Scale down the image resolution according to its visible size in the PDF document; may cause distortion with some image configurations |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Argument out of range |
CopyPage(Int32)
Creates a new PDF by copying a page from this PdfDocument.
Declaration
public PdfDocument CopyPage(int PageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Index of the page. Note: Page 1 has index 0... |
Returns
Type | Description |
---|---|
PdfDocument | A new PdfDocument |
CopyPages(IEnumerable<Int32>)
Creates a new PDF by copying a range of pages from this PdfDocument.
Declaration
public PdfDocument CopyPages(IEnumerable<int> PageIndexes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | An IEnumerable of page indexes to copy into the new PDF. |
Returns
Type | Description |
---|---|
PdfDocument | A new PdfDocument |
CopyPages(Int32, Int32)
Creates a new PDF by copying a range of pages from this PdfDocument.
Declaration
public PdfDocument CopyPages(int StartIndex, int EndIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | StartIndex | The index of the first PDF page to copy.. Note: Page 1 has index 0 |
System.Int32 | EndIndex | The index of the last PDF page to copy.> |
Returns
Type | Description |
---|---|
PdfDocument | A new PdfDocument |
Dispose()
Releases used resources.
Declaration
public void Dispose()
DrawBitmap(Bitmap, IEnumerable<Int32>, IEnumerable<Double>, IEnumerable<Double>, IEnumerable<Double>, IEnumerable<Double>, PixelFormat)
Draw a bitmap multiple times according to the specified parameters; all occurrences of the bitmap will share a single data stream
Declaration
public void DrawBitmap(Bitmap bitmap, IEnumerable<int> page_indices, IEnumerable<double> xs, IEnumerable<double> ys, IEnumerable<double> desired_widths, IEnumerable<double> desired_heights, PixelFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Bitmap | bitmap | Bitmap to draw |
System.Collections.Generic.IEnumerable<System.Int32> | page_indices | Target page indices |
System.Collections.Generic.IEnumerable<System.Double> | xs | X coordinates |
System.Collections.Generic.IEnumerable<System.Double> | ys | Y coordinates |
System.Collections.Generic.IEnumerable<System.Double> | desired_widths | Desired widths |
System.Collections.Generic.IEnumerable<System.Double> | desired_heights | Desired heights |
System.Drawing.Imaging.PixelFormat | format | Pixel format |
DrawBitmap(Bitmap, Int32, Double, Double, Double, Double, PixelFormat)
Draw a bitmap a single time according to the specified parameters
Declaration
public void DrawBitmap(Bitmap bitmap, int page_index, double x, double y, double desired_width, double desired_height, PixelFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Bitmap | bitmap | Bitmap to draw |
System.Int32 | page_index | Page index |
System.Double | x | X coordinate |
System.Double | y | Y coordinate |
System.Double | desired_width | Desired width |
System.Double | desired_height | Desired Height |
System.Drawing.Imaging.PixelFormat | format | Pixel format |
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 |
|
FromUrl(Uri, String, String)
Opens a PDF on a URL for editing.
Declaration
public static PdfDocument FromUrl(Uri Uri, string Password = "", string OwnerPassword = "")
Parameters
Type | Name | Description |
---|---|---|
System.Uri | Uri | The URI to the PDF. |
System.String | Password | Optional user password if the PDF document is encrypted. |
System.String | OwnerPassword | Optional password if the PDF document is protected by owner (printing, modifying restrictions etc..). |
Returns
Type | Description |
---|---|
PdfDocument | An IronPdf.PdfDocument object as loaded from the file path. |
Exceptions
Type | Condition |
---|---|
IronPdfProductException | Exception thrown if cannot read the PDF due to incorrect uri or password. |
GetAnnotationCount(Int32)
Retrieve the number of annotations contained on the specified page
Declaration
public int GetAnnotationCount(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Page index |
Returns
Type | Description |
---|---|
System.Int32 | Number of annotations contained on the page |
GetPageRotation(Int32)
Gets the rotation of a PDF page in degrees.
Declaration
public PdfPageRotation GetPageRotation(int PageIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Index of the page to inspect. PageIndex is a 'Zero based' page number, the first page being 0. |
Returns
Type | Description |
---|---|
PdfPageRotation | Degrees of rotation |
GetPrintDocument(PrinterSettings, PrintController)
Returns a System.Drawing.Printing.PrintDocument for the PDF allowing developers granular control over sending the PDF to a Printer.
An assembly reference to System.Drawing is required in your project.
Printer settings. Note: If you create a new PrinterSettings() we recommend setting printerSettings.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); custom printController such as PreviewPrintController for a GUI print previewDeclaration
public PrintDocument GetPrintDocument(PrinterSettings printerSettings = null, PrintController printController = null)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Printing.PrinterSettings | printerSettings | |
System.Drawing.Printing.PrintController | printController |
Returns
Type | Description |
---|---|
System.Drawing.Printing.PrintDocument | A System.Drawing.Printing.PrintDocument. |
Exceptions
Type | Condition |
---|---|
System.Exception | IronPdf must be licensed to use this feature. |
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> Documents)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<PdfDocument> | Documents | A IEnumerable of PdfDocument. To merge existing PDF files you may use the PdfDocument.FromFile static method in conjunction with Merge. |
Returns
Type | Description |
---|---|
PdfDocument | A new, merged PdfDocument |
PageToBitmap(Int32, Int32)
Renders a single page of the PDF to a 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()
Prints this PDF by sending it to the computer's printer.
For advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
if true print preview dialogs will be displayed to the user. Default value is false.Declaration
public int Print()
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
Print(Boolean)
Declaration
public int Print(bool showPreview)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
Print(Int32)
Prints this PDF by sending it to the computer's printer.
For even more advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
the horizontal and vertical PDF resolutions, in dots per inch. if-1
print with default
printer resolution. Default value is -1
.
Declaration
public int Print(int dpi)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
Print(Int32, Boolean)
Declaration
public int Print(int dpi, bool showPreview)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
Print(Int32, Int32, String, String, PrintController)
Prints this PDF by sending it to the computer's printer.
For even more advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
the horizontal PDF resolution, in dots per inch.the vertical PDF resolution, in dots per inch.the name of a printer, setnull or an empty string ("") to use default print. Default value is null.the file path, when printing to a file, setfilePath
. The default value is null.
Declaration
public int Print(int dpiX, int dpiY, string printerName = null, string filePath = null, PrintController customPrintController = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpiX | |
System.Int32 | dpiY | |
System.String | printerName | |
System.String | filePath | |
System.Drawing.Printing.PrintController | customPrintController |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
Print(Int32, String, String)
Prints this PDF by sending it to the computer's printer.
For even more advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
the horizontal and vertical PDF resolutions, in dots per inch. if-1
print with default
printer resolution. Default value is -1
.the name of a printer, setnull or an empty string ("") to use default print. Default value is null.the file path, when printing to a file, set filePath
. The default value is null.
Declaration
public int Print(int dpi, string printerName = null, string filePath = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi | |
System.String | printerName | |
System.String | filePath |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
Print(Int32, String, String, Boolean)
Declaration
public int Print(int dpi, string printerName = null, string filePath = null, bool showPreview = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi | |
System.String | printerName | |
System.String | filePath | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
Print(String)
Prints this PDF by sending it to the computer's printer.
For even more advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
the name of a printer, setnull or an empty string ("") to use default print. Default value is null.Declaration
public int Print(string printerName)
Parameters
Type | Name | Description |
---|---|---|
System.String | printerName |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
Print(String, Boolean)
Declaration
public int Print(string printerName, bool showPreview)
Parameters
Type | Name | Description |
---|---|---|
System.String | printerName | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
PrintToFile(Int32, String)
Prints this PDF by sending it to the computer's printer.
For advanced real-world printing options please see overloads of this method and also GetPrintDocument(PrinterSettings, PrintController).
the horizontal and vertical PDF resolutions, in dots per inch. if-1
print with default printer
resolution. Default value is -1
.output file path, if set to null or an empty string ("") default filePath will be random GUID.
Declaration
public int PrintToFile(int dpi, string filePath = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi | |
System.String | filePath |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
PrintToFile(Int32, String, Boolean)
Declaration
public int PrintToFile(int dpi, string filePath = null, bool showPreview = false)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dpi | |
System.String | filePath | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
PrintToFile(String)
Prints this PDF by sending it to the computer's printer.
For advanced real-world printing options please see overloads GetPrintDocument(PrinterSettings, PrintController).
output file path, if set to null or an empty string ("") default filePath will be random GUID.Declaration
public int PrintToFile(string filePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath |
Returns
Type | Description |
---|---|
System.Int32 | The number of printed pages. |
PrintToFile(String, Boolean)
Declaration
public int PrintToFile(string filePath, bool showPreview = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | filePath | |
System.Boolean | showPreview |
Returns
Type | Description |
---|---|
System.Int32 |
QuickSignPdfWithDigitalSignatureFile(String, String)
Sign PDF with digital signature certificate. For more advanced options please see SignPdfWithDigitalSignature(PdfSignature)
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 |
ResizePage(Int32, Double, Double)
Resize a page to the specified dimensions (in millimeters)
Declaration
public void ResizePage(int PageIndex, double PageWidth, double PageHeight)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Page index to resize |
System.Double | PageWidth | Desired page width, in millimeters |
System.Double | PageHeight | Desired page height, in millimeters |
RotateAllPages(PdfPageRotation)
Rotates all pages of the PdfDocument by a specified number of degrees.
Declaration
public void RotateAllPages(PdfPageRotation Rotation)
Parameters
Type | Name | Description |
---|---|---|
PdfPageRotation | Rotation | Degrees of rotation |
RotatePage(Int32, PdfPageRotation)
Rotates one page of the PdfDocument by a specified number of degrees.
Declaration
public void RotatePage(int PageIndex, PdfPageRotation Rotation)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | PageIndex | Index of the page to rotate. PageIndex is a 'Zero based' page number, the first page being 0. |
PdfPageRotation | Rotation | Degrees of rotation |
RotateSelectedPages(IEnumerable<Int32>, PdfPageRotation)
Rotates selected pages of the PdfDocument by a specified number of degrees.
Declaration
public void RotateSelectedPages(IEnumerable<int> PageIndexes, PdfPageRotation Rotation)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | PageIndexes | Indexes of the pages to rotate in an IEnumerable, list or array. PageIndex is a 'Zero based' page number, the first page being 0. |
PdfPageRotation | Rotation | Degrees of rotation |
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 |
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 |
|