PdfForm Class
A form XObject is a PDF content stream that is a self-contained description of any sequence of graphics objects (including path objects, text objects, and sampled images).
A form XObject may be painted multiple times—either on several pages or at several locations on the same page—and produces the same results each time, subject only to the graphics state at the time it is invoked.
public sealed class PdfForm : PdfExternalObject
Public NotInheritable Class PdfForm
Inherits PdfExternalObject
- Inheritance:
- System.ObjectPdfForm
Constructors
PdfForm(PdfDocument, PdfSize)
Initializes a new instance of the PdfForm class.
public PdfForm(PdfDocument document, PdfSize size)
Public Sub New(document As PdfDocument, size As PdfSize)
Parameters
document
- PdfDocument
The PdfDocument associated with the PdfForm.
Exceptions
- System.ArgumentNullException
document
is null.
Properties
BoundingBox
(Required) The form XObject's bounding box, used to clip the form XObject and to determine its size for caching.
Property Value
The form XObject's bounding box, used to clip the form XObject and to determine its size for caching.
Exceptions
- System.ArgumentNullException
Value is null.
See Also
Content
Gets the content of the PdfForm.
Returns null if the PdfForm doesn't have an associated resource dictionary. In that case use either GetContent(PdfContent) to retrieve the read-only content of the PdfForm with PdfContentResources (fonts, images, etc.) resolved from the specified PdfContent or SetResources(PdfContent) method to set PdfContentResources (fonts, images, etc.) from the specified PdfContent to this PdfForm before retrieving the Content property.
Property Value
Gets a value of type PdfContent that represents the collection of PdfContentElements in the PdfForm.
Remarks
A PdfForm stores its rendering data in a content stream (whose data consists of a sequence of instructions describing the graphical elements to be painted) and an associated resource dictionary. For more information on how PdfForms store graphics data, see 7.8, "Content Streams and Resources".
See Also
Size
Gets the form size in the original (untransformed) coordinate system in which Transform is Identity.
Property Value
Transform
(Optional) An array of six numbers specifying the form matrix, which maps form space into user space (see 8.3.4, "Transformation Matrices"). Default value: the identity matrix [1 0 0 1 0 0].
Property Value
An array of six numbers specifying the form matrix, which maps form space into user space.
See Also
Methods
GetContent(PdfContent)
Gets the read-only content of the PdfForm with PdfContentResources (fonts, images, etc.) resolved from the specified resourcesProvider
.
To get the editable content of the PdfForm, use the Content property and, optionally, SetResources(PdfContent) method before it, if the Content property returns null.
public PdfContent GetContent(PdfContent resourcesProvider)
Public Function GetContent(resourcesProvider As PdfContent) As PdfContent
Parameters
resourcesProvider
- PdfContent
The PdfContent whose PdfContentResources (fonts, images, etc.) are used to resolve resources used by the PdfForm's content stream.
Returns
The read-only content of the PdfForm with PdfContentResources (fonts, images, etc.) resolved from the specified resourcesProvider
.
SetBoundingBox(Double, Double, Double, Double)
Sets the BoundingBox.
public void SetBoundingBox(double left, double bottom, double right, double top)
Public Sub SetBoundingBox(left As Double, bottom As Double, right As Double, top As Double)
Parameters
left
- System.Double
The left X coordinate of the BoundingBox.
bottom
- System.Double
The bottom Y coordinate of the BoundingBox.
right
- System.Double
The right X coordinate of the BoundingBox.
top
- System.Double
The top Y coordinate of the BoundingBox.
SetResources(PdfContent)
Sets the PdfContentResources (fonts, images, etc.) from the specified PdfContent to this PdfForm.
This method is useful if the Content property returns null (if the PdfForm doesn't have an associated resource dictionary).
public void SetResources(PdfContent resourcesProvider)
Public Sub SetResources(resourcesProvider As PdfContent)
Parameters
resourcesProvider
- PdfContent
The PdfContent whose PdfContentResources (fonts, images, etc.) are set to this PdfForm.
Inherited Properties
AssociatedFiles | (Optional; PDF 2.0) An array of one or more PdfFileSpecifications which denote the associated files for this PdfImage or PdfForm. (Inherited from PdfExternalObject) |
Document | Gets the PdfDocument associated with this PdfContentResource or null if no PdfDocument is associated with this PdfContentResource. (Inherited from PdfContentResource) |
Metadata | (Optional; PDF 1.4) A metadata stream containing metadata for the component. (Inherited from PdfObject) |