pdfjs icon indicating copy to clipboard operation
pdfjs copied to clipboard

The document could not be saved. There was a problem reading this document (23)

Open hugodion opened this issue 3 years ago • 7 comments

Hi ! An error displays when saving a downloaded PDF report from the web - "The document could not be saved. There was a problem reading this document (23)."

Deselecting Acrobat "Save As Optimizes for Fast Web View" works but I was wondering if it could be fixed when generating de pdf? Thanks !

hugodion avatar Oct 06 '20 15:10 hugodion

Hi, in which browser are you opening and saving the document, and you are using an acrobat browser extension I presume?

rkusa avatar Oct 13 '20 07:10 rkusa

Hi, Chrome without the acrobat extension. But it's seems to be related to acrobat reader itself. Just like here: https://support.delivra.com/hc/en-us/articles/360000843853-I-get-an-Adobe-Acrobat-error-when-saving-a-report-as-PDF

hugodion avatar Oct 13 '20 17:10 hugodion

I think I am still doing it wrong when trying to reproduce. This is what I am doing:

  1. Open http://pdfjs.rkusa.st/ in Chrome
  2. Download the resulting PDF (using the download button in the top right of the PDF viewer)
  3. Try to open the PDF in Acrobat Reader DC

Acrobat Reader DC opens the download PDF without an error.

Can you advice me on what I might do wrong trying to reproduce the issue? Thanks!

rkusa avatar Oct 23 '20 14:10 rkusa

Hi ! Here is a code sample: `"use strict";

const pdf = require("pdfjs"); const fs = require("fs");

const doc = new pdf.Document({ font: require("pdfjs/font/Helvetica"), fontSize: 13, padding: 42, lineHeight: 1, width: 792, height: 612, });

doc.pipe(fs.createWriteStream("test.pdf"));

doc._cursor.y = 140;

const alias = doc._fontAlias(doc.defaultFont);

const text2 = doc.text({ font: require("pdfjs/font/Helvetica-Bold"), fontSize: 14, textAlign: "center", color: "0x9A9B9C", }); text2.add("Hello!\n\n");

doc.end();`

And when I try to save it whit "Save As optimizes for Fast Web View" in Acrobat, it gives me this error: test.pdf

image

hugodion avatar Oct 26 '20 20:10 hugodion

It downloads but I cannot save it:

image

hugodion avatar Oct 26 '20 20:10 hugodion

Thanks for the additional details, I am able to reproduce it now. Though I have no idea yet what the issue might be, especially since the error message lacks details and I couldn't find any use full logs.

rkusa avatar Nov 13 '20 08:11 rkusa

Anyone found a fix?

yoavTaieb avatar Oct 13 '21 08:10 yoavTaieb