Namespace: PdfSharp.Drawing
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, System.IDisposable, PdfSharp.Pdf.Advanced.IContentStream
Inheritance Object → XImage → XForm → XPdfForm
Implements IDisposable, IContentStream
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; }
Gets the underlying PdfPage (if one exists).
public PdfPage Page { get; }
Gets the number of pages in the PDF form.
public int PageCount { get; }
Use either PixelWidth or PointWidth. Temporarily obsolete because of rearrangements for WPF.
Gets the width in point of the page identified by the property PageNumber.
public double Width { get; }
Use either PixelHeight or PointHeight. Temporarily obsolete because of rearrangements for WPF.
Gets the height in point of the page identified by the property PageNumber.
public double Height { get; }
Gets the width in point of the page identified by the property PageNumber.
public double PointWidth { get; }
Gets the height in point of the page identified by the property PageNumber.
public double PointHeight { get; }
Gets the width in point of the page identified by the property PageNumber.
public int PixelWidth { get; }
Gets the height in point of the page identified by the property PageNumber.
public int PixelHeight { get; }
Get the size of the page identified by the property PageNumber.
public XSize Size { get; }
Gets or sets the transformation matrix.
public XMatrix Transform { get; set; }
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; }
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; }
Gets the view box of the form.
public XRect ViewBox { get; }
Gets 72, the horizontal resolution by design of a form object.
public double HorizontalResolution { get; }
Gets 72 always, the vertical resolution by design of a form object.
public double VerticalResolution { get; }
Gets or sets the bounding box.
public XRect BoundingBox { get; set; }
Gets or sets a flag indicating whether image interpolation is to be performed.
public bool Interpolate { get; set; }
Gets the format of the image.
public XImageFormat Format { get; }
Creates an XPdfForm from a file.
public static XPdfForm FromFile(string path)
path
String
Creates an XPdfForm from a stream.
public static XPdfForm FromStream(Stream stream)
stream
Stream
Sets the form in the state FormState.Finished.
internal void Finish()
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 void Dispose(bool disposing)
disposing
Boolean
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, Int32& pageNumber)
path
String
pageNumber
Int32&