Downloading multiple documents

Hi there, I wanted to see if there was any way to easily download a group of different PDFs via the front end. We’re using an Angular app… so far I’ve had luck with using this code to generate a PDF download for the current document loaded:

const { docViewer, annotManager } = this.wvInstance;
const doc = docViewer.getDocument();
const xfdfString = await annotManager.exportAnnotations();

const options = {
xfdfString,
downloadType: ‘pdf’
};
const data = await doc.getFileData(options);
const arr = new Uint8Array(data);
const blob = new Blob([arr], { type: ‘application/pdf’ });

I’m starting to look into how this could be altered so that I can generate blobs for other PDFs that are not currently loaded in the instance. Any help would be much appreciated!

Hello ,

If you want to download a group of different PDFs, can you use window.fetch API to download the documents as blobs? If so, then I found this stack overflow post with some sample code: https://stackoverflow.com/questions/32545632/how-can-i-download-a-file-using-window-fetch

let me know if you have more questions.
Check your ticket status - https://support.pdftron.com/helpdesk/tickets/19037

Best Regards,
Oscar Zhang
Software Developer
PDFTron Systems, Inc.
www.pdftron.com

CONFIDENTIALITY NOTICE: This message (and any attachment to it) is intended only for the use of the individual or entity to which it is addressed in the header, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Any reproduction, distribution, modification or use of the contents of this message (and any attachment to it) by any individual or entity other than the intended recipient is prohibited. If you have received this communication in error, please notify us immediately and delete the original.