The source PDF as a URL string, Uint8Array, or ArrayBuffer
Array of highlights to embed in the PDF
Export options for customizing colors and behavior
Promise
const pdfBytes = await exportPdf(pdfUrl, highlights, {
textHighlightColor: "rgba(255, 255, 0, 0.4)",
onProgress: (current, total) => console.log(`${current}/${total} pages`)
});
// Download the file
const blob = new Blob([pdfBytes], { type: "application/pdf" });
const url = URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = "annotated.pdf";
a.click();
URL.revokeObjectURL(url);
Export a PDF with annotations embedded.