Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

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

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

    example
    const resultUrl = await CfgnFiles.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()}`,
      },
    ]);
    

    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

createPdfFromAssets

  • createPdfFromAssets(bundleAliasName: string, assetTasks: CreatePdfTasks[], cfgnFileName: string, cfgnFileDisplayName?: string): Promise<string | undefined>
  • Creates a PDF from one or more assets which will be merged in the given order.

    Simplified helper built on top of convertDocument. Use convertDocument directly for advanced scenarios.

    example
    const resultUrl = await CfgnFiles.createPdfFromAssets(
     'MyBundle',
     [
       {
         type: 'PdfAsset',
         assetPath: 'quotePdfAsset',
         context: {
           subject: 'MySubject',
         },
       },
       {
         type: 'Asset',
         assetPath: 'Pdf2',
       },
     ],
     'QuotePdf',
     `Your_quote_${new Date().toISOString()}`
    );
    

    Parameters

    • bundleAliasName: string

      Bundle name where the assets are stored

    • assetTasks: CreatePdfTasks[]

      One or more "assets tasks" which will be merged in the given order

    • cfgnFileName: string

      Name of the generated cfgn file

    • Optional cfgnFileDisplayName: string

      Optional name which will be used when downloading the file

    Returns Promise<string | undefined>

    URL to the generated cfgn file, if successful

createPdfFromHtml

  • createPdfFromHtml(name: string, html: string, displayName?: string, pdfOptions?: Html2PdfOptions): Promise<string | undefined>
  • Converts a given HTML to PDF and uploads the resulting pdf to the given resource

    deprecated

    Please use CfgnFiles.createPdfFromAssets and associated PDF Asset workflow instead.

    Parameters

    • name: string

      Name of the file to which the generated PDF should be uploaded. Can be used in Hive with configuration.GetFile("")

    • html: string

      The HTML itself which needs to be converted to a PDF

    • Optional displayName: string

      Optional name which will be used when downloading the file

    • Optional pdfOptions: Html2PdfOptions

      PDF generation options

    Returns Promise<string | undefined>

    The url of the PDF if successful

uploadFiles

  • Upload one or more files into the current configuration

    Type parameters

    • T: string

    Parameters

    • files: CfgnFiles<T>

      The key represents the name, which can be used in Hive with configuration.GetFile("")

    Returns Promise<CfgnFileUploadResult<T>>

    An object with the same keys as the input. The values contain according result information.

uploadImages

  • Upload one or more images into the current configuration

    Type parameters

    • T: string

    Parameters

    • files: CfgnFiles<T>

      The key represents the name, which can be used in Hive with configuration.GetImage("")

    Returns Promise<CfgnFileUploadResult<T>>

    An object with the same keys as the input. The values contain according result information.

Generated using TypeDoc