Nutrient Web SDK

v0.0.0-dev

Function build

Performs processing via Nutrient Backend Build API.

  • Document Engine (requires Document Engine >= 1.6.0)
  • DWS

In you are running in standalone mode, the resulting ArrayBuffer can be converted to PDF with NutrientViewer.convertToPDF() (if it's not already PDF) and then loaded with NutrientViewer.load().

FunctionSince Document Engine 1.6.0
Type Signature
build(
    authPayload: ProcessingAuthPayload,
    instructions: BuildInstructions,
    inputs?: BuildInput[],
): Promise<ArrayBuffer>
  • Since Document Engine 1.6.0

    Type Declaration

    Parameters

    Information needed to authenticate processing request with Nutrient backend.

    instructionsBuildInstructions

    Build API instructions that describe the processing operation.

    inputsBuildInput[]
    Optional

    An array of all inputs required for the processing operation.

    Returns

    Promise that resolves to an ArrayBuffer with the processing result. In case of an error, rejects with a NutrientViewer.Error with detailed error message.

    Example

    NutrientViewer.build(
    // Authorize request.
    { jwt: authPayload.jwt },
    // Instructions for the processing request.
    {
    parts: [
    // Use first input as the first part of the final document.
    { file: "document" },
    // Use a sample DOCX document served from URL as the second part of the final document.
    {
    file: {
    url: "https://www.nutrient.io/api/downloads/samples/docx/document.docx",
    },
    },
    ],
    },
    // Inputs required by the request. These will be uploaded with the request. The remote file served from URL does not need to be uploaded.
    [{ name: "document", content: document }]
    );