PdfFormContent Class
Represents a PDF content that is a self-contained description of any sequence of PdfContentElements.
public sealed class PdfFormContent : PdfVisualContentElementPublic NotInheritable Class PdfFormContent
Inherits PdfVisualContentElement- Inheritance:
- System.ObjectPdfFormContent
Properties
Bounds
Gets the bounds of the PdfFormContent.
Property Value
The bounds of the PdfFormContent.
Overrides
Remarks
This member, although exposed as a property for easier debugging, performs complex calculations, so instead of accessing it frequently, cache its result instead.
Content
Gets the content of the associated Form subject to the Format of the current PdfFormContent.
The returned PdfContent is editable, and editing it clones the Form and the clone's content is set to this edited content when retrieving the Form property. To modify the Form's content, use its Content.
note
Methods BeginEdit(), EndEdit(Boolean), and CancelEdit() do not have any affect when called on a Content instance. To cancel editing of the PdfContent by discarding changes and rolling back to content specified in the Form's underlying content stream subject to the Format of the current PdfFormContent, set the Form property to the value retrieved before the Content was edited.
Property Value
The content of the Form subject to the Format of the current PdfFormContent.
Remarks
note
If the content is edited, when retrieving the Form property, the Form is cloned and the clone's content is set to this edited content. This makes sure that the group XObject's behavior is maintained which is especially important for transparency group XObjects and that GemBox.Pdf.Content.Colors.PdfPatternColorSpace of fill or stroke color of any element contained in the edited content is correct because the pattern is relative to the Form.
If the associated Form is a transparency group XObject then the implicitly modified Format is used instead. Implicit modifications are: the blend mode initialized to Normal, the stroking and nonstroking alpha constants to 1.0, and the soft mask to None (see 11.6.6, "Transparency Group XObjects").
See Also
ElementType
Gets the Form value.
public override PdfContentElementType ElementType { get; }Public Overrides ReadOnly Property ElementType As PdfContentElementTypeProperty Value
The Form value.
Overrides
Form
Gets the form or null if the content is a PostScript language fragment or sets the form.
Property Value
The form or null if the content is a PostScript language fragment.
Remarks
If PdfForm value that is being set is associated with another PdfDocument, this property setter will automatically clone it and associate the clone with the current PdfDocument.
If the Content is edited, the Form is cloned and the clone's content is set to the edited Content when retrieving the Form property. This makes sure that the group XObject's behavior is maintained which is especially important for transparency group XObjects and that GemBox.Pdf.Content.Colors.PdfPatternColorSpace of fill or stroke color of any element contained in the edited Content is correct because the pattern is relative to the Form.
Exceptions
- System.ArgumentNullException
Value is null.
Methods
Flatten(Boolean)
Replaces the PdfFormContent in the PdfContentElementCollection with a PdfContentGroup that represents flattened representation of the PdfFormContent as specified in the PDF Specification ISO 32000-1:2008, section '8.10 Form XObjects' when the Do operator is applied to a form XObject.
public PdfContentGroup Flatten(bool recursive = false)Public Function Flatten(recursive As Boolean = False) As PdfContentGroupParameters
recursive- System.Boolean
If set to true then all the descendant PdfFormContent elements will also be flattened so that returned PdfContentGroup won't contain any descendant PdfFormContent element.
Returns
A PdfContentGroup that represents a flattened representation of the PdfFormContent and replaces it in the PdfContentElementCollection.
Remarks
A PdfContentGroup that represents a flattened representation of the PdfFormContent has the following properties and behavior:
- The PdfContentGroup's Format is equal to the PdfFormContent's Format.
- The PdfContentGroup's Transform is equal to the PdfFormContent's Transform.
- The First element in the PdfContentGroup's Elements is a clipping PdfPathContent created from the Form's BoundingBox.
- Transform of all elements contained in the PdfContentGroup's Elements is multiplied with the Form's Transform.
After flattening, the Elements collection of the Content is empty. To roll back to content specified in the Form's underlying content stream subject to the Format of the current PdfFormContent, set the Form property to its previously retrieved value.
warning
Flattening should not be done if the associated Form is a group XObject because the group's behavior is then lost which especially affects transparency group XObjects.
Flattening should also not be done if the Content contains any element whose fill or stoke color space is GemBox.Pdf.Content.Colors.PdfPatternColorSpace because the pattern is relative to the Form.
Exceptions
- System.InvalidOperationException
The PdfFormContent is not contained in any PdfContentElementCollection.
See Also
Inherited Properties
| Collection | Gets the PdfContentElementCollection that the PdfContentElement belongs to. (Inherited from PdfContentElement) |
| Format | Gets or sets the formatting properties applied to the PdfVisualContentElement. (Inherited from PdfVisualContentElement) |
| Next | Gets the next PdfContentElement in the Collection. (Inherited from PdfContentElement) |
| Previous | Gets the previous PdfContentElement in the Collection. (Inherited from PdfContentElement) |
| Transform | Gets or sets the transformation from the new (transformed) coordinate system to the original (untransformed) coordinate system. All coordinates used after the transformation are expressed in the transformed coordinate system. tipBefore setting the Transform, move PdfVisualContentElement into its own PdfContentGroup so that the transformation is confined to that PdfContentGroup and doesn't have any effect on PdfContentElements outside that PdfContentGroup. (Inherited from PdfVisualContentElement) |