Table of Contents

Class XPdfForm

Namespace
PdfSharp.Drawing
Assembly
PdfSharp.dll

Represents a so called 'PDF form external object', which is typically an imported page of an external PDF document. XPdfForm objects are used like images to draw an existing PDF page of an external document in the current document. XPdfForm objects can only be placed in PDF documents. If you try to draw them using a XGraphics based on an GDI+ context no action is taken if no placeholder image is specified. Otherwise, the place holder is drawn.

public class XPdfForm : XForm, IDisposable
Inheritance
XPdfForm
Implements
Inherited Members

Properties

Page

Gets the underlying PdfPage (if one exists).

public PdfPage? Page { get; }

Property Value

PdfPage

PageCount

Gets the number of pages in the PDF form.

public int PageCount { get; }

Property Value

int

PageIndex

Gets or sets the page index in the external PDF document this object refers to. The page index is zero-based, i.e. it is in the range from 0 to PageCount - 1. The default value is 0.

public int PageIndex { get; set; }

Property Value

int

PageNumber

Gets or sets the page number in the external PDF document this object refers to. The page number is one-based, i.e. it is in the range from 1 to PageCount. The default value is 1.

public int PageNumber { get; set; }

Property Value

int

PixelHeight

Gets the height in point of the page identified by the property PageNumber.

public override int PixelHeight { get; }

Property Value

int

PixelWidth

Gets the width in point of the page identified by the property PageNumber.

public override int PixelWidth { get; }

Property Value

int

PlaceHolder

Gets or sets an image that is used for drawing if the current XGraphics object cannot handle PDF forms. A place holder is useful for showing a preview of a page on the display, because PDFsharp cannot render native PDF objects.

public XImage? PlaceHolder { get; set; }

Property Value

XImage

PointHeight

Gets the height in point of the page identified by the property PageNumber.

public override double PointHeight { get; }

Property Value

double

PointWidth

Gets the width in point of the page identified by the property PageNumber.

public override double PointWidth { get; }

Property Value

double

Size

Get the size in point of the page identified by the property PageNumber.

public override XSize Size { get; }

Property Value

XSize

Transform

Gets or sets the transformation matrix.

public override XMatrix Transform { get; set; }

Property Value

XMatrix

Methods

Dispose(bool)

Frees the memory occupied by the underlying imported PDF document, even if other XPdfForm objects refer to this document. A reuse of this object doesn’t fail, because the underlying PDF document is re-imported if necessary.

protected override void Dispose(bool disposing)

Parameters

disposing bool

ExtractPageNumber(string, out int)

Extracts the page number if the path has the form 'MyFile.pdf#123' and returns the actual path without the number sign and the following digits.

public static string ExtractPageNumber(string path, out int pageNumber)

Parameters

path string
pageNumber int

Returns

string

FromFile(string)

Creates an XPdfForm from a file.

public static XPdfForm FromFile(string path)

Parameters

path string

Returns

XPdfForm

FromStream(Stream)

Creates an XPdfForm from a stream.

public static XPdfForm FromStream(Stream stream)

Parameters

stream Stream

Returns

XPdfForm