Replies: 3 comments 4 replies
-
Could you elaborate a bit @monkiki ?
|
Beta Was this translation helpful? Give feedback.
-
Sorry, I wanted to know if I can configure an HTTP POST endpoint where pdf.js would send the modified PDF and not just download it. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
-
It actually wasn't that bad @monkiki PDFViewerApplication.save = async () => {
if (PDFViewerApplication._saveInProgress) {
return;
}
PDFViewerApplication._saveInProgress = true;
await PDFViewerApplication.pdfScriptingManager.dispatchWillSave();
const url = PDFViewerApplication._downloadUrl;
const filename = PDFViewerApplication._docFilename;
try {
PDFViewerApplication._ensureDownloadComplete();
const data = await PDFViewerApplication.pdfDocument.saveDocument();
const blob = new Blob([data], {
type: "application/pdf",
});
console.log(blob, data, url, filename);
// await PDFViewerApplication.downloadManager.download(
// blob,
// url,
// filename,
// options
// );
} catch (reason) {
console.error(`Error when saving the document: ${reason.message}`);
await PDFViewerApplication.download(options);
} finally {
await PDFViewerApplication.pdfScriptingManager.dispatchDidSave();
PDFViewerApplication._saveInProgress = false;
}
}; Then just upload the to whatever endpoint you desire. |
Beta Was this translation helpful? Give feedback.
-
I would like to know if there is any way to intercept the "save" toolbar button so the annotated PDF can be summited to another URL.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions