Nutrient Web SDK
    Preparing search index...

    Function convertToPDF

    • Converts a file to a PDF.

      Returns a https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise|Promise resolving to an ArrayBuffer of a PDF, or rejecting with a NutrientViewer.Error.

      The resulting ArrayBuffer can be directly loaded with ().

      It requires a configuration object. If the configuration is invalid, the promise will be rejected with a NutrientViewer.Error.

      Parameters

      • configuration: StandaloneConfiguration

        A configuration Object

      • Optionalconformance:
            | null
            | | "pdfa-1a"
            | "pdfa-1b"
            | "pdfa-2a"
            | "pdfa-2u"
            | "pdfa-2b"
            | "pdfa-3a"
            | "pdfa-3u"
            | "pdfa-3b"
            | "pdfa-4"
            | "pdfa-4e"
            | "pdfa-4f"

        A conformance level of the output PDF

      • OptionalofficeConversionSettings: OfficeConversionSettings

        Settings specific to office conversion

      Returns Promise<ArrayBuffer>

      Promise that resolves to an ArrayBuffer of a file converted to PDF

      NutrientViewer.convertToPDF({
      document: "/sales-report.docx",
      licenseKey: "YOUR_LICENSE_KEY",
      }).then((arrayBuffer) => {
      console.log("Successfully converted document", arrayBuffer);
      }).catch((error) => {
      console.error(error.message);
      })

      @public