New to Telerik Document ProcessingStart a free 30-day trial

Reusable PDF form (XObject) content container owning a ContentElementCollection; instantiate once and place via multiple Form instances to avoid duplicating drawing operations.

Definition

Namespace:Telerik.Windows.Documents.Fixed.Model.Resources

Assembly:Telerik.Windows.Documents.Fixed.dll

Syntax:

C#
public class FormSource : IContentRootElement, IContainerElement, IFixedDocumentElement

Inheritance: objectFormSource

Implements: IContainerElementIContentRootElementIFixedDocumentElement

Constructors

Initialize an empty form ready to accept content elements.

C#
public FormSource()

Methods

Create a reusable form (XObject) from a 2D barcode with explicit target size in DIPs.

C#
public static FormSource From2DBarcode(Symbology2DType symbology, string value, int width, int height)
Parameters:symbologySymbology2DType

The 2D barcode symbology. See Symbology2DType.

valuestring

The data to encode in the 2D barcode.

widthint

Target barcode width in DIPs.

heightint

Target barcode height in DIPs.

Returns:

FormSource

Remarks:

Modules are sized to fit within the provided width and height. Sizing snaps to whole DIP units to preserve crisp edges.

Create a reusable form (XObject) from a 2D barcode (e.g., QR, Swiss QR) using a default size of 100x100 DIPs.

C#
public static FormSource From2DBarcode(Symbology2DType symbology, string value)
Parameters:symbologySymbology2DType

The 2D barcode symbology. See Symbology2DType.

valuestring

The data to encode in the 2D barcode.

Returns:

FormSource

Remarks:

If value is null or empty, no modules are generated and the returned form will have a size of 0x0.

Create a reusable form (XObject) from a 1D barcode using the specified symbology and default size, optionally rendering human‑readable text.

C#
public static FormSource FromBarcode(Symbology1DType symbology, string value, bool showText)
Parameters:symbologySymbology1DType

The 1D barcode symbology to use. See Symbology1DType.

valuestring

The data to encode in the barcode.

showTextbool

True to render the human‑readable value centered below the bars.

Returns:

FormSource

A FormSource representing the barcode content.

Remarks:

Text is rendered using Helvetica. Alignment is centered horizontally and aligned to the bottom of the form.

Create a reusable form (XObject) from a 1D barcode with explicit size and optional human‑readable text.

C#
public static FormSource FromBarcode(Symbology1DType symbology, string value, int width, int height, bool showText)
Parameters:symbologySymbology1DType

The 1D barcode symbology to use. See Symbology1DType.

valuestring

The data to encode in the barcode.

widthint

Target barcode width in DIPs.

heightint

Target barcode height in DIPs.

showTextbool

True to render the human‑readable value centered below the bars.

Returns:

FormSource

A FormSource representing the barcode content.

Remarks:

Editing strategy: to "edit" a barcode already placed on a page, generate a new FormSource with the updated value and assign it to the existing FormSource or remove/redraw using FixedContentEditor. Barcode content is generated at creation time and is not mutable afterward.

Create a reusable form (XObject) from a 1D barcode with explicit target size in DIPs.

C#
public static FormSource FromBarcode(Symbology1DType symbology, string value, int width, int height)
Parameters:symbologySymbology1DType

The 1D barcode symbology to use. See Symbology1DType.

valuestring

The data to encode in the barcode.

widthint

Target barcode width in DIPs.

heightint

Target barcode height in DIPs.

Returns:

FormSource

A FormSource representing the barcode content.

Remarks:

When drawn at a different size than width x height, the form is scaled. For crisp output, draw at the measured size or pass the same size to DrawForm(FormSource, double, double).

If value is null or empty, no bars are generated. The returned form width will be 0 and height equals the requested height.

Create a reusable form (XObject) from a 1D barcode value using the specified symbology and default size of 100x100 DIPs.

C#
public static FormSource FromBarcode(Symbology1DType symbology, string value)
Parameters:symbologySymbology1DType

The 1D barcode symbology to use. See Symbology1DType.

valuestring

The data to encode in the barcode.

Returns:

FormSource

A FormSource representing the barcode content.

Remarks:

Units are device‑independent pixels (DIPs), where 96 DIPs = 1 inch. The returned form may be drawn on any page using DrawForm(FormSource) or wrapped in a Form and added to the page content.

If value is null or empty, no bars are generated. The returned form will have zero width and the default height.

To show human‑readable text under the bars, use an overload accepting showText.

Create a form from raw SVG bytes (UTF‑8 encoded XML expected).

C#
public static FormSource FromSvg(byte[] svgData)
Parameters:svgDatabyte[]

The byte array containing the SVG file data.

Returns:

FormSource

A FormSource object representing the SVG content.

Create a form whose drawing commands are produced from an SVG stream.

C#
public static FormSource FromSvg(Stream stream)
Parameters:streamStream

The stream containing the SVG file data.

Returns:

FormSource

A FormSource object representing the SVG content.

Create a form from SVG XML text.

C#
public static FormSource FromSvg(string xml)
Parameters:xmlstring

The SVG XML string representing the form.

Returns:

FormSource

A FormSource object representing the SVG content.

Properties

Annotation collection (not supported for form content and will throw).

C#
public AnnotationCollection Annotations { get; }

Implements: IContentRootElement.Annotations

Collection of child drawing elements composing the form’s appearance.

C#
public ContentElementCollection Content { get; }
Property Value:

The content.

Implements: IContainerElement.Content

Root structure element used as the starting point when auto‑tagging is active.

C#
public StructureElement DefaultStructureRoot { get; }
Property Value:

The default structure root.

Implements: IContentRootElement.DefaultStructureRoot

Parent content element (always null because a form source is a root entity).

C#
public IFixedDocumentElement Parent { get; }

Implements: IFixedDocumentElement.Parent

Size

Size

Logical width and height bounding the form’s coordinate space.

C#
public Size Size { get; set; }

Implements: IContentRootElement.Size

Stack tracking nested structure elements while building tagged content.

C#
public Stack<StructureElement> StructureStack { get; }
Property Value:

The structure stack.

Implements: IContentRootElement.StructureStack

Indicates support for annotations (always false for forms).

C#
public bool SupportsAnnotations { get; }

Implements: IContentRootElement.SupportsAnnotations

Indicates whether automatic tagging is supported (forms do not support it).

C#
public bool SupportsAutoTagging { get; }
Property Value:

True if the element supports auto tagging.

Implements: IContentRootElement.SupportsAutoTagging