pdfjs
pdfjs copied to clipboard
error creating new external PDF document with base64 PDF
const dataUrl = 'data:application/octet-binary;base64,' + url; const blob = await fetch(dataUrl) .then((res) => res.blob()); const ext = new pdf.ExternalDocument(blob.arrayBuffer());
got error Name must start with a leading slash, found: %
const dataUrl = 'data:application/octet-binary;base64,' + url; const blob = await fetch(dataUrl) .then((res) => res.blob()); const file = new Blob( [blob], { type: 'application/pdf' }, ); const fileURL = URL.createObjectURL(blob); const res = await fetch(fileURL).then((data) => data.blob()); const ext = new pdf.ExternalDocument(res.arrayBuffer());
same error.
Hi, this error is most probably related to a syntax error in the PDF your are trying to add, see https://github.com/rkusa/pdfjs/issues/218. Your code looked good form a quick glance, so I'd almost expect that it should work with most PDFs.