@combeenation/custom-code-sdk
    Preparing search index...

    Function convertDocument

    • 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) and append a static product datasheet.

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

      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>

      URL to the generated cfgn file, if successful

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