mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 14:48:08 +02:00
Ensure that saving, in the viewer, works for partially loaded documents
Currently saving a modified PDF document may fail *intermittently*, if it's triggered before the entire document has been downloaded. When saving was originally added we only supported forms, and such PDF documents are usually small/simple enough for this issue to be difficult to trigger. However, with editing-support now available as well it's possible to modify much larger documents and this issue thus becomes easier to trigger. One way to reproduce this issue *consistently* is to: - Open http://localhost:8888/web/viewer.html?file=/test/pdfs/pdf.pdf#disableHistory=true&disableStream=true&disableAutoFetch=true - Add an annotation on the first page, it doesn't matter what kind. - Save the document. - Open the resulting document, and notice that with the `master` branch the annotation is missing.
This commit is contained in:
parent
2effc96021
commit
7c5e9cf8be
1 changed files with 1 additions and 4 deletions
|
@ -1109,8 +1109,6 @@ const PDFViewerApplication = {
|
|||
await this.pdfScriptingManager.dispatchWillSave();
|
||||
|
||||
try {
|
||||
this._ensureDownloadComplete();
|
||||
|
||||
const data = await this.pdfDocument.saveDocument();
|
||||
this.downloadManager.download(
|
||||
data,
|
||||
|
@ -1119,8 +1117,7 @@ const PDFViewerApplication = {
|
|||
options
|
||||
);
|
||||
} catch (reason) {
|
||||
// When the PDF document isn't ready, or the PDF file is still
|
||||
// downloading, simply fallback to a "regular" download.
|
||||
// When the PDF document isn't ready, fallback to a "regular" download.
|
||||
console.error(`Error when saving the document: ${reason.message}`);
|
||||
await this.download(options);
|
||||
} finally {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue