Skip to main content
Version: v2026.0.0

Document builder

The document builder lets users assemble pages from one or more open documents into new output documents. Pages can be reordered, removed, or combined across documents using drag-and-drop in a dedicated panel.

How it works

The document builder panel shows thumbnails of all pages from currently open documents. Users drag pages into one or more output document slots, reorder them, and save the result. The assembled document is sent to the broker, which produces a new PDF from the selected pages.

Data model

An assembly is described by an AlterContentDescriptionMultiSplit, which contains a list of output documents. Each output document is an ordered list of SourcePageDescription entries, where each entry references a source document ID and a page index (0-based). Optional DocumentMetadata can be attached to each output document.

Content update behavior

When saving, the builder uses one of these behaviors:

BehaviorDescription
UPDATE_NO_DOCUMENTProduce the result without replacing any existing document
UPDATE_FIRST_DOCUMENTReplace the first source document with the result
CREATE_NEW_FIRST_DOCUMENTCreate a new document from the first output slot
UPDATE_ALL_DOCUMENTReplace all source documents
UPDATE_FIRST_DOCUMENT_PDFASame as UPDATE_FIRST_DOCUMENT, output as PDF/A
CREATE_NEW_FIRST_DOCUMENT_PDFASame as CREATE_NEW_FIRST_DOCUMENT, output as PDF/A

JavaScript API

The document builder is controllable through the ARender JavaScript API:

// Open, toggle, or close the panel
getARenderJS().getDocumentBuilder().open();
getARenderJS().getDocumentBuilder().toggle();
getARenderJS().getDocumentBuilder().close();

// Reset the current assembly
getARenderJS().getDocumentBuilder().reset();

// Save the first output document
getARenderJS().getDocumentBuilder().saveFirstDocument(download, delete, freeze, behavior);

// Save all output documents
getARenderJS().getDocumentBuilder().saveAllDocuments(handler, download, delete, freeze, behavior);

// Create an empty document in the builder
getARenderJS().getDocumentBuilder().createEmptyDocument();

// Create a document from JSON content
getARenderJS().getDocumentBuilder().createCustomDocument(jsonContent, options);

Parameters for saveFirstDocument and saveAllDocuments:

ParameterTypeDescription
downloadbooleanDownload the result after saving
deletebooleanDelete source documents after saving
freezebooleanLock the source documents after saving
behaviorstringOne of the content update behaviors listed above

Callbacks

Register callbacks to react to builder events:

// Fires after save completes, receives the result document ID
getARenderJS().getDocumentBuilder().registerNotifyAlterDocumentContentEvent(callback);

// Fires before submission to the server (intercept/modify)
getARenderJS().getDocumentBuilder().registerSubmitAlterDocumentContentEvent(callback);

// Fires when the builder panel opens
getARenderJS().getDocumentBuilder().registerDocumentBuilderOpeningEvent(callback);

// Fires on custom document save
getARenderJS().getDocumentBuilder().registerDocumentBuilderSaveCustomEvent(callback);

Configuration

For the full list of document builder properties, see Viewer configuration — Document builder.