Creating PDF documents with the Web Document Scanner SDK
The Scanbot Web SDK offers functionality for PDF generation.
Create the appropriate generator as follows:
const options: Partial<PdfConfiguration> = { pageSize: "A4", pageDirection: "PORTRAIT", pageFit: "FIT_IN", dpi: 72, jpegQuality: 80 };
const generator = await scanbotSDK.beginPdf(options);
Options
See the API reference for a list of available options and how they play together.
Adding individual pages
You can add individual images to your PDF document:
await generator.addPage(image);
Adding all pages of a document
If you obtained a document from the RTU UI, you can add all pages at once:
await generator.addPages(document);
When all images have been added, complete the transaction and receive the resulting byte array:
const bytes = await generator.complete();
As an example, you can force the PDF download of the pages in the browser via:
function saveBytes(data, name) {
const extension = name.split(".")[1];
const a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
const blob = new Blob([data], {type: `application/${extension}`});
const url = window.URL.createObjectURL(blob);
a.href = url;
a.download = name;
a.click();
window.URL.revokeObjectURL(url);
}
And then call it as such:
saveBytes(bytes, "generated.pdf");
Want to scan longer than one minute?
Generate a free trial license to test the Scanbot SDK thoroughly.
Get free trial licenseScanbot SDK is part of the Apryse SDK product family
A mobile scan is just the start. With Apryse SDKs, you can expand mobile workflows into full cross‑platform document processing. Whether you need to edit PDFs, add secure digital signatures, or use a fast, customizable document viewer and editor, Apryse gives you the tools to build powerful features quickly.
Learn more
