Nutrient Web SDK

Function convertToOffice

Converts a document to the specified supported conversion format.

Returns a Promise resolving to an ArrayBuffer of the converted document, or rejecting with a NutrientViewer.Error.

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

Function
Type Signature
convertToOffice(
    configuration: StandaloneConfiguration,
    format: "docx" | "xlsx" | "pptx",
): Promise<ArrayBuffer>
  • Type Declaration

    Parameters

    configurationStandaloneConfiguration

    A configuration Object.

    format"docx" | "xlsx" | "pptx"

    Format to export the document to.

    Returns

    Promise that resolves to an ArrayBuffer of the converted file

    Example

    NutrientViewer.convertToOffice({
    document: "/article.pdf",
    licenseKey: "YOUR_LICENSE_KEY",
    },
    NutrientViewer.OfficeDocumentFormat.docx
    ).then((arrayBuffer) => {
    console.log("Successfully converted document", arrayBuffer);
    }).catch((error) => {
    console.error(error.message);
    })

    @public