Represents a dynamic product interface with methods to interact with and manipulate various aspects of a dynamic product.

interface DynamicProduct {
    Loaded: boolean;
    NumPages: number;
    GetFieldById(fieldId: string): DynamicProductField;
    GetFieldDetails(fieldName: string): DynamicFieldModel;
    GetFieldIds(pageIndex: number): string[];
    GetFieldNames(): string[];
    GetFieldText(fieldName: string): string;
    GetPageSize(pageIndex: number): Rectangle;
    Impress(fileInstance: FileInstance): boolean;
    ImpressOn(targetPage: PdfPage, sourcePage: number): boolean;
    Load(dpId: number): boolean;
    LoadFromFile(json: string): boolean;
    LoadFromJob(dopId: number): boolean;
    PrepareAppearance(): boolean;
    PrepareAppearanceWith(width: number, height: number): boolean;
    SetFieldFile(fieldName: string, fileObj: FileInstance): boolean;
    SetFieldText(fieldName: string, text: string): boolean;
}

Properties

Loaded: boolean

Indicates whether the dynamic product is currently loaded. This property is read-only.

True if the product is loaded, false otherwise.

NumPages: number

Gets the number of pages in the dynamic product. This property is read-only.

The total number of pages in the product.

Methods

  • Retrieves a field by its ID.

    Parameters

    • fieldId: string

      The ID of the field to retrieve.

    Returns DynamicProductField

    The field object corresponding to the specified ID.

  • Retrieves detailed information about a specified field by its name.

    Parameters

    • fieldName: string

      The name of the field to get details for.

    Returns DynamicFieldModel

    An object containing detailed information about the specified field.

  • Retrieves the IDs of all fields on a specified page.

    Parameters

    • pageIndex: number

      The index of the page to get field IDs for.

    Returns string[]

    An array containing the IDs of all fields on the specified page.

  • Retrieves the names of all fields in the dynamic product.

    Returns string[]

    An array containing the names of all fields.

  • Retrieves the text content of a specified field.

    Parameters

    • fieldName: string

      The name of the field from which to retrieve the text.

    Returns string

    The current text content of the specified field.

  • Retrieves the size of a specified page by its index.

    Parameters

    • pageIndex: number

      The index of the page to retrieve the size for.

    Returns Rectangle

    An object representing the size of the page or null if the page index is invalid.

  • Impresses the dynamic product onto a specified file. This typically involves generating a file with the product's content.

    Parameters

    • fileInstance: FileInstance

      The target file instance where the product will be impressed.

    Returns boolean

    Returns true if the product was successfully impressed onto the file, false otherwise.

  • Impresses content from the dynamic product onto a specified PDF page.

    Parameters

    • targetPage: PdfPage

      The PDF page where the content will be impressed.

    • sourcePage: number

      The index of the source page from the dynamic product.

    Returns boolean

    Returns true if the content was successfully impressed onto the target page, false otherwise.

  • Loads a dynamic product by its ID.

    Parameters

    • dpId: number

      The ID of the dynamic product to load.

    Returns boolean

    Returns true if the product was successfully loaded, false otherwise.

  • Loads a dynamic product from a JSON string. Useful for loading a product's state from a serialized format.

    Parameters

    • json: string

      The JSON string representing the product to load.

    Returns boolean

    Returns true if the product was successfully loaded from the JSON string, false otherwise.

  • Loads a dynamic product from a job by the job's ID. Typically used to load products associated with a specific order or job.

    Parameters

    • dopId: number

      The ID of the dynamic order product to load.

    Returns boolean

    Returns true if the product was successfully loaded from the job, false otherwise.

  • Prepares the appearance of the dynamic product using default dimensions.

    Returns boolean

    Returns true if the appearance was successfully prepared, false otherwise.

  • Prepares the appearance of the dynamic product, specifying width and height. Useful for ensuring the product renders correctly in different contexts.

    Parameters

    • width: number

      The desired width for the appearance preparation.

    • height: number

      The desired height for the appearance preparation.

    Returns boolean

    Returns true if the appearance was successfully prepared, false otherwise.

  • Sets the file content for a specified field, usually for image fields.

    Parameters

    • fieldName: string

      The name of the field to set the file for.

    • fileObj: FileInstance

      The file object to associate with the field.

    Returns boolean

    Returns true if the file was successfully set, false otherwise.

  • Updates the text content of a specified field.

    Parameters

    • fieldName: string

      The name of the field to update.

    • text: string

      The new text content to set for the field.

    Returns boolean

    Returns true if the text was successfully updated, false otherwise.