diff --git a/web/app.js b/web/app.js index 927d7143ede44..8bcb86f20d69e 100644 --- a/web/app.js +++ b/web/app.js @@ -1073,22 +1073,12 @@ const PDFViewerApplication = { ); }, - /** - * @private - */ - _ensureDownloadComplete() { - if (this.pdfDocument && this.downloadComplete) { - return; - } - throw new Error("PDF document not downloaded."); - }, - async download(options = {}) { let data; try { - this._ensureDownloadComplete(); - - data = await this.pdfDocument.getData(); + if (this.downloadComplete) { + data = await this.pdfDocument.getData(); + } } catch { // When the PDF document isn't ready, or the PDF file is still // downloading, simply download using the URL. @@ -1109,8 +1099,6 @@ const PDFViewerApplication = { await this.pdfScriptingManager.dispatchWillSave(); try { - this._ensureDownloadComplete(); - const data = await this.pdfDocument.saveDocument(); this.downloadManager.download( data, @@ -1119,8 +1107,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 {