• Create and convert a document (e.g. HTML to PDF).
    The conversion consists of multiple individual tasks to allow full flexibility when creating documents.

    Example case: Create a PDF with dynamic content (PDF asset), append a static product datasheet and put a watermark on each page.

    See also createPdfFromAssets for a simplified version to create a PDF.

    Returns

    URL to the generated cfgn file, if successful

    Example

    const resultUrl = await CfgnFiles.convertDocument([
    {
    type: DocumentConvertTaskTypes.PdfAsset,
    name: 'HtmlToPdfTask',
    bundleAliasName: 'MyBundle',
    assetPath: 'quotePdfAsset',
    context: {
    subject: 'MySubject',
    },
    },
    {
    type: DocumentConvertTaskTypes.Watermark,
    inputTaskName: 'HtmlToPdfTask',
    name: 'WatermarkTask',
    options: {
    text: 'My Watermark',
    opacity: 50
    },
    },
    {
    type: DocumentConvertTaskTypes.OutputToCfgnFile,
    name: 'OutputPdfTask',
    inputTaskName: 'WatermarkTask',
    cfgnFileName: 'QuotePdf',
    cfgnFileExtension: 'pdf',
    cfgnFileDisplayName: `Your_quote_${new Date().toISOString()}`,
    },
    ]);

    Parameters

    • tasks: DocumentConvertTask[]

      The tasks are executed based on their connection with the properties name and inputTaskName (the order in the array is irrelevant)

    Returns Promise<string | undefined>

Generated using TypeDoc