Function build
FunctionSince Document Engine 1.6.0
Type Signature
build(
authPayload: ProcessingAuthPayload,
instructions: BuildInstructions,
inputs?: BuildInput[],
): Promise<ArrayBuffer>
authPayload: ProcessingAuthPayload,
instructions: BuildInstructions,
inputs?: BuildInput[],
): Promise<ArrayBuffer>
- Since Document Engine 1.6.0
Type Declaration
Parameters
authPayloadProcessingAuthPayloadInformation needed to authenticate processing request with Nutrient backend.
instructionsBuildInstructionsBuild API instructions that describe the processing operation.
An array of all inputs required for the processing operation.
Returns
Promise that resolves to an
ArrayBufferwith 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 }]
);
Performs processing via Nutrient Backend Build API.
In you are running in standalone mode, the resulting
ArrayBuffercan be converted to PDF with NutrientViewer.convertToPDF() (if it's not already PDF) and then loaded with NutrientViewer.load().