Generate PDFs from images using JavaScript
When calling PSPDFKit#load() with Nutrient Web SDK, you can pass either an array buffer or a URL to the image into the document option. Or, when calling PSPDFKit#load() in Server mode, you can pass the documentId. After doing this, Nutrient Web SDK will open the image file as if it were a PDF document:
const res = await fetch("https://example.com/example.tiff");const imageArrayBuffer = await res.arrayBuffer();NutrientViewer.load({ document: imageArrayBuffer // Other options.});Image documents can be loaded the same way in headless mode by providing the headless option:
NutrientViewer.load({ document: image, headless: true});For more information on loading options, follow our guides on importing a PDF document.
Exporting image documents
Image documents can be exported as PDF documents by using Instance#exportPDF() and triggering a download, as explained in the save a document to local storage guide.