Telerik.Documents.AI.Tools.Fixed.Core
Provides static tools for creating and manipulating PDF document content.
These tools handle content segments including text, images, tables, and document structure.
Provides static tools for working with PDF form fields.
These tools handle form field reading and filling operations.
Utility class for PDF form-related operations including field information extraction,
form filling, and summary generation for interactive PDF forms.
Gets comprehensive information about a single form field and its properties.
Extracts type-specific information for text fields, checkboxes, combo boxes,
list boxes, radio buttons, and other interactive form elements.
The form field to extract information from.
A object containing detailed information about the form field including its type, properties, and current values.
Generates a comprehensive summary of form fields including counts, field types,
and structural information about the PDF form.
List of form field information objects to summarize.
A formatted string containing statistics about the form fields including total count, required fields, read-only fields, and breakdown by field type.
Fills form fields in a PDF document with provided values and returns a detailed summary of the operations.
Supports partial form filling, skips read-only fields, and provides comprehensive error reporting.
Field matching is performed by both field name and display name for flexibility.
The PDF document containing interactive form fields to fill.
Dictionary mapping field names to their corresponding values. Keys should match form field names or display names.
A tuple containing:
- fieldsFilledCount: Number of fields successfully filled
- fieldsSummary: List of summary messages describing successful operations and skipped fields
- fieldErrors: List of error messages for fields that could not be filled
Gets the user-friendly display name for a form field, preferring UserInterfaceName over Name.
This method provides a fallback mechanism to ensure a meaningful name is always returned.
The form field to get the display name for.
The UserInterfaceName if available and not empty, otherwise returns the Name property. Returns null if both are null.
Gets the human-readable string representation of the form field type.
Provides specific type names for different field variants (e.g., distinguishes between
regular text fields, password fields, and multi-line text fields).
The form field to determine the type for.
A descriptive string representing the field type. Returns the class name as fallback for unknown types.
Provides a unified interface for managing PDF (Fixed) documents.
Extends IDocumentRepository with PDF-specific capabilities.
Repository for multi-document orchestration scenarios.
Manages multiple PDF documents in memory with support for creation and import.
Initializes a new instance with no documents.
Timeout for import operations, or null to allow unlimited time.
Adds an existing document to the repository.
The identifier for the document.
The document to add.
Base class for all content segments that can be added to PDF documents
The type of content segment
Base class for text-based segments with formatting properties
The text content to add
Font size in points. Default is 12.
Font family name. Supported: 'Arial', 'Helvetica', 'Times', 'Times New Roman', 'Courier', 'Courier New'. Default is 'Arial'.
Text color in hex format (e.g., '#FF0000' for red). Default is black.
Highlight color in hex format (e.g., '#FFFF00' for yellow). Leave empty for no highlight.
Whether the text should be bold. Default is false.
Whether the text should be italic. Default is false.
Underline style: 'None' or 'Single'. Default is 'None'.
Strikethrough style: 'None' or 'Single'. Default is 'None'.
Baseline alignment: 'Baseline', 'Subscript', or 'Superscript'. Default is 'Baseline'.
Horizontal alignment of the paragraph containing this text: 'Left', 'Center', 'Right', 'Justified'. Leave empty to keep current alignment.
Segment that inserts an image into the PDF document
The path to the image file to insert. Supports common formats: JPEG, PNG, BMP, TIFF, GIF. Must be an absolute path or relative to the current working directory.
The width of the image in points. If not specified, the original image width will be used. Must be a positive number.
The height of the image in points. If not specified, the original image height will be used. Must be a positive number.
Whether to maintain the original aspect ratio when width or height is specified. If true, the image will be scaled proportionally. Default is true.
Text segment that inserts formatted text followed by a line break
Segment that forces content to start on a new page
Segment that starts a new paragraph with configurable paragraph properties
Spacing before the paragraph in points. Default is 0.
Spacing after the paragraph in points. Default is 0.
Left indent in points. Default is 0.
Right indent in points. Default is 0.
First line indent in points. Default is 0.
Horizontal alignment: 'Left', 'Center', 'Right', 'Justified'. Default is 'Left'.
Background color for the paragraph in hex format (e.g., '#FFFFFF'). Leave empty for no background.
Text segment that inserts inline formatted text without line breaks
Segment that starts a new section with different page properties
Page size for the new section: 'A4', 'Letter', 'Legal', 'A3', 'A5'. Default is 'A4'.
Page rotation: 'Rotate0', 'Rotate90', 'Rotate180', 'Rotate270'. Default is 'Rotate0'.
Segment that inserts a table into the PDF document
Array of table rows. Each row is an array of cell data (strings).
Optional array of header cells for the table. If provided, will be formatted differently from regular rows.
Whether the table should have borders. Default is true.
Background color for header row in hex format (e.g., '#F0F0F0'). Only applied if headers are provided.
Text color for header row in hex format (e.g., '#000000'). Only applied if headers are provided.
Font size for header text in points. Default is 12.
Font size for table text in points. Default is 10.
Detailed information about checkbox field properties
Whether the checkbox is currently checked
The export value when the checkbox is checked
Detailed information about combo box field properties
Array of available options in the combo box
Currently selected value
Detailed information about list box field properties
Array of available options in the list box
Array of currently selected values
Whether the list box allows multiple selections
Detailed information about a PDF form field
The internal name/identifier of the form field
The user-friendly interface name of the form field
The best display name for the field (UserInterfaceName if available, otherwise Name)
The type of form field (e.g., 'Text Field', 'Checkbox Field', 'Combo Box Field')
Whether this field is required to be filled
Whether this field is read-only and cannot be modified
Detailed information for text fields (null for other field types)
Detailed information for checkbox fields (null for other field types)
Detailed information for combo box fields (null for other field types)
Detailed information for list box fields (null for other field types)
Detailed information for radio button fields (null for other field types)
Value to be set for a specific form field
The name/identifier of the form field
The value to set for text fields, combo boxes, and comb text fields
The checked state for checkbox fields
Array of selected values for list box and radio button fields
Container for form field values to be filled into a PDF form
Dictionary of field name to field value mappings
Result of getting PDF form fields information
Whether the PDF contains interactive form fields
Total number of form fields found
Array of detailed information about each form field
Summary description of the form analysis results
Detailed information about radio button field properties
Array of available radio button options
Currently selected option
Detailed information about text field properties
Current text value of the field
Maximum number of characters allowed (0 means no limit)
Whether the field supports multiple lines of text
Whether the field is a password field (text is masked)
Whether the field uses comb formatting (fixed-width character cells)
Utility class for PDF form-related operations including field information extraction,
form filling, and summary generation for interactive PDF forms.
Gets comprehensive information about a single form field and its properties.
Extracts type-specific information for text fields, checkboxes, combo boxes,
list boxes, radio buttons, and other interactive form elements.
The form field to extract information from.
A object containing detailed information about the form field including its type, properties, and current values.
Generates a comprehensive summary of form fields including counts, field types,
and structural information about the PDF form.
List of form field information objects to summarize.
A formatted string containing statistics about the form fields including total count, required fields, read-only fields, and breakdown by field type.
Fills form fields in a PDF document with provided values and returns a detailed summary of the operations.
Supports partial form filling, skips read-only fields, and provides comprehensive error reporting.
Field matching is performed by both field name and display name for flexibility.
The PDF document containing interactive form fields to fill.
Dictionary mapping field names to their corresponding values. Keys should match form field names or display names.
A tuple containing:
- fieldsFilledCount: Number of fields successfully filled
- fieldsSummary: List of summary messages describing successful operations and skipped fields
- fieldErrors: List of error messages for fields that could not be filled
Gets the user-friendly display name for a form field, preferring UserInterfaceName over Name.
This method provides a fallback mechanism to ensure a meaningful name is always returned.
The form field to get the display name for.
The UserInterfaceName if available and not empty, otherwise returns the Name property. Returns null if both are null.
Gets the human-readable string representation of the form field type.
Provides specific type names for different field variants (e.g., distinguishes between
regular text fields, password fields, and multi-line text fields).
The form field to determine the type for.
A descriptive string representing the field type. Returns the class name as fallback for unknown types.
Comprehensive utility class for PDF document operations including content segment processing,
text formatting, image insertion, table creation, and document structure management.
Provides methods for converting various content types into PDF elements using Telerik RadPdfProcessing.
Converts a string representation of page size to PaperTypes enum.
The page size string (case-insensitive). Supported values: 'A4', 'Letter', 'Legal', 'A3', 'A5'.
The corresponding PaperTypes enum value, defaults to A4 for unrecognized values.
Removes trailing PageBreak segments from content segments array to prevent empty pages
when the segments are processed by a PDF document editor.
Array of content segments to process.
A new array of content segments with any trailing PageBreak segments removed.
Processes a content segment by calling the appropriate handler based on segment type.
Supports text runs, lines, paragraph breaks, page breaks, section breaks, images, and tables.
The RadFixedDocumentEditor instance used to insert content into the PDF document.
The content segment to process. The segment type determines which processing method is called.
Processes a formatted text segment, applying all text formatting properties including font,
color, decorations, and baseline alignment before inserting the text into the document.
The RadFixedDocumentEditor to use for text insertion.
The formatted text segment containing text content and formatting properties.
If true, inserts text as a line (with line break); if false, inserts as a run (inline).
Processes a paragraph break segment, applying paragraph formatting properties such as spacing,
indentation, alignment, and background color before inserting a paragraph break.
The RadFixedDocumentEditor to use for paragraph insertion.
The paragraph break segment containing paragraph formatting properties.
Processes a section break segment, configuring new section properties including page size
and rotation before inserting a section break that starts a new section in the document.
The RadFixedDocumentEditor to use for section break insertion.
The section break segment containing page size and rotation settings.
Processes an image segment by loading the image file and inserting it into the document
with the specified dimensions and aspect ratio settings.
The RadFixedDocumentEditor to use for image insertion.
The image segment containing file path and sizing information.
Processes a table segment by creating a formatted table with the specified data, headers,
borders, and styling options, then inserting it into the document.
The RadFixedDocumentEditor to use for table insertion.
The table segment containing table data, headers, and formatting options.
Sets font properties for the document editor, selecting appropriate font from the FontsRepository
based on family name and style requirements. Falls back to Helvetica if font selection fails.
The RadFixedDocumentEditor to configure.
Font family name. Supported: "Arial", "Helvetica", "Times", "Times New Roman", "Courier", "Courier New".
Whether text should be bold (uses bold font variant).
Whether text should be italic (uses italic/oblique font variant).
Sets text foreground and highlight background colors for the document editor.
Text color defaults to black if not provided or invalid.
The RadFixedDocumentEditor to configure.
Text foreground color in hex format (e.g., "#FF0000"). If null/empty/invalid, defaults to black.
Text highlight background color in hex format (e.g., "#FFFF00"). If null/empty/invalid, no highlight is applied.
Sets text decoration patterns (underline and strikethrough) for the document editor.
Both decorations default to "None" if not specified or unrecognized.
The RadFixedDocumentEditor to configure.
Underline style. Supported values: "Single", "None". Case-insensitive.
Strikethrough style. Supported values: "Single", "None". Case-insensitive.
Sets baseline alignment for the document editor to control vertical text positioning
relative to the baseline (normal, subscript, or superscript).
The RadFixedDocumentEditor to configure.
Baseline alignment setting. Supported values: "Baseline", "Subscript", "Superscript". Case-insensitive. Defaults to "Baseline".
Parses a color string in hex format into a Telerik RgbColor object for use in PDF documents.
Uses System.Drawing.ColorTranslator for robust color parsing.
Color string in hex format (e.g., "#FF0000", "#ffffff").
RgbColor object if parsing succeeds, null if color is null/empty.
Calculates the final size for an image based on the provided width, height, and aspect ratio settings.
When maintaining aspect ratio, chooses the scaling constraint that results in the smaller scaling factor
to ensure the image fits within both specified dimensions.
The image source containing original dimensions.
Desired width in points. If null, original width is used unless height is specified with aspect ratio maintenance.
Desired height in points. If null, original height is used unless width is specified with aspect ratio maintenance.
If true, preserves original aspect ratio by scaling proportionally. If false, uses exact specified dimensions.
A Size object representing the calculated final dimensions for the image.
Loads an image from the specified file path and inserts it inline into the PDF document at the current position.
Calculates final dimensions based on size constraints and aspect ratio settings before insertion.
The RadFixedDocumentEditor to insert the image into.
The absolute or relative path to the image file.
Optional width constraint in points. If null, uses original width or calculated width based on height and aspect ratio.
Optional height constraint in points. If null, uses original height or calculated height based on width and aspect ratio.
If true, maintains original aspect ratio when scaling. If false, uses exact specified dimensions.
Creates and inserts a formatted table into the PDF document using the RadFixedDocumentEditor.
Implements proper table creation patterns based on official Telerik SDK guidelines,
including optional headers, borders, and comprehensive styling options.
The RadFixedDocumentEditor to insert the table into.
Array of table data rows, where each row is an array of cell values.
Optional array of header cell values. If provided, creates a styled header row. Can be null to skip headers.
If true, applies black borders to the table and all cells with small padding. If false, creates a borderless table.
Background color for header cells in hex format (e.g., "#F0F0F0"). Only applied if headers are provided. Can be null or empty.
Text color for header cells in hex format (e.g., "#000000"). Only applied if headers are provided. Can be null or empty.
Font size in points for header text.
Font size in points for regular table cell text.
var tableData = new string[][] {
new[] { "Product", "Price", "Stock" },
new[] { "Widget A", "$10.99", "25" },
new[] { "Widget B", "$15.99", "10" }
};
var headers = new[] { "Item", "Cost", "Available" };
CreateAndInsertTable(editor, tableData, headers, true, "#E0E0E0", "#000000", 12, 10);
Provides validation utilities for PDF-related operations.
Ensures PDF file descriptors and properties meet application requirements.
Validates content segment based on its type and properties.
Validates formatted text parameters including content, font, colors, and styling options.
Validates font size is within acceptable bounds.
Validates font family is supported.
Validates color format (hex format required).
Validates underline pattern is supported.
Validates strikethrough pattern is supported.
Validates baseline alignment is supported.
Validates horizontal alignment is supported (optional field).
Validates paragraph break segment properties.
Validates section break segment properties.
Validates image segment properties.
Validates table segment properties.
Validates that an image path is within the configured image directory and exists.
Requires explicit permission via IMAGE_DIR environment variable for security.
The image file path to validate
The configured image directory (required for security)
Validates image parameters by reusing the comprehensive ImageSegment validation.
This reduces code duplication between InsertImage and ValidateImageSegment methods.
The image file path to validate
Optional width constraint
Optional height constraint
The configured image directory for security validation
Validates table data including rows, headers, and formatting parameters.
Array of table rows
Optional header row
Header background color
Header text color
Font size for header text
Font size for table text
Provides extension methods for registering Fixed document agent tools and related services with an .
Adds Fixed document agent tools to the service collection.
The service collection.
Configuration options for document processing.