PDFs of scanned documents are incompatible with Adobe Reader

Bug #1220826 reported by Till Kamppeter on 2013-09-04
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Simple Scan
Fix Released
High
Robert Ancell
3.10
Fix Released
High
Robert Ancell
3.12
Fix Released
High
Robert Ancell
3.4
Fix Released
High
Robert Ancell
3.6
Fix Released
High
Robert Ancell
simple-scan (Ubuntu)
High
Robert Ancell
Precise
High
Robert Ancell
Trusty
High
Robert Ancell

Bug Description

[Impact]
PDF files generated by simple-scan are not readable from Acrobat reader due to incorrectly formatted PDF trailers. Other PDF readers ignore these errors.

[Test Case]
1. Open Simple Scan
2. Scan a document
3. Save as a PDF file
4. Open with Acrobat reader
Expected result:
PDF file opens and show scanned contents
Observed results:
PDF file fails to open due to error

[Regression Potential]
PDF files are generated slightly differently and other readers could potentially read them differently. This seems low as the current generation is clearly not spec compliant, online compliant checkers pick up the errors and now don't complain. Evince continues to open both the broken and fixed PDF files.

Related branches

Till Kamppeter (till-kamppeter) wrote :

Attached is a sample file generated by simple-scan in Saucy. Scanner is an HP LaserJet 3390 (multi-function device) using HPLIP.

Michael Nagel (nailor) wrote :

can you please check if this can be fixed by the procedure described in Bug #741628

can you please also use `ubuntu-bug simple-scan` to upload some simple-scan meta data? thanks!

Michael Nagel (nailor) wrote :

also: what kind of error do you get with adobe reader?

apport information

tags: added: apport-collected saucy
description: updated

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

I tried the workaround from bug 741628:

simple-scan --fix-pdf simple-scan-test.pdf

simple-scan simply segfaults, on both Raring and Saucy.

On Android's Adobe Reader I get an error like

the document cannot be opened because it is corrupted or damaged

All PDF readers on my Ubuntu box and all PDF readers on my Android tablet, except Adobe Reader display the file correctly.

For the segfault of simple-scan see bug 1220839.

Changed in simple-scan (Ubuntu):
milestone: ubuntu-13.10 → saucy-updates
Michael Nagel (nailor) wrote :

now that the segfault is fixed, any success on the originial problem?

Changed in simple-scan (Ubuntu):
status: New → Incomplete
description: updated

The problem still persists with the current versions of simple-scan in Saucy and Trusty when simply scanning and saving the file. Applying "simple-scan --fix-pdf" does not cause a segfault any more, and also does not fix the files. The files are still unreadable for the Adobe Reader on my Nexus 7 (Android 4.4).

Michael Nagel (nailor) wrote :

quite possibly the file is not a valid pdf file. unfortunatly i do not really know how to validate a pdf file, but according to this web service ( http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx ) the test scan fails quite badly.

Changed in simple-scan:
status: New → Triaged
importance: Undecided → High
moimael (moimael) wrote :

Is there a specific reason for creating the pdf by hand and not using cairo directly to create the pdf ?

Robert Ancell (robert-ancell) wrote :

I was initially using Cairo to generate the PDFs but I couldn't set all the metadata I wanted or choose the appropriate compression to make sure the files we minimum size.

Changed in simple-scan (Ubuntu):
status: Incomplete → Confirmed
tremu (trumeable) wrote :

The only workaround that works for me is using pdftk to repair the pdf:

pdftk file.pdf output file-repaired.pdf

Michael Nagel (nailor) wrote :

could you please attach a broken and a repaired pdf? thanks!

tremu (trumeable) wrote :

Broken pdf directly from simple-scan

tremu (trumeable) wrote :

The same pdf after repairing with pdftk

tremu (trumeable) wrote :

Ok, using the online validator web both seem damaged.
Using the latest version of Adobe Reader for Android (Apr 17, 2014) all the pdfs I tried open without warning, including simple-scan-test.pdf provided by till-kamppeter. With previous versions of Adobe Reader (in android) damaged pdfs wouldn't open, seems like they fixed that now.
When opening broken.pdf with acroread 8.1.7 (in linux) it says "the file is damaged but is being repaired" while fixed.pdf opens without warning.

Robert Ancell (robert-ancell) wrote :

Thanks for the comparison tremu! Looking at the differences and re-reading the PDF standard I think I've fixed the problems in lp:~robert-ancell/simple-scan/fix-pdf-trailer. The online validator also seems more happy (aside from complaining about optional PDF features required for PDF/A).

Can someone please try this branch and see if it works for them?

Note you can run simple-scan --fix-pdf <filename> to fix any PDFs that were incorrectly generated due to this bug.

Changed in simple-scan:
status: Triaged → In Progress
assignee: nobody → Robert Ancell (robert-ancell)
Changed in simple-scan (Ubuntu):
status: Confirmed → Triaged
Changed in simple-scan (Ubuntu Precise):
status: New → Triaged
importance: Undecided → High
Changed in simple-scan (Ubuntu Trusty):
milestone: saucy-updates → none
tremu (trumeable) wrote :

I can't try this branch, it doesn't compile. I get an error:

page.vala:146.19-146.45: error: only automatic properties can have default values
        default = ScanDirection.TOP_TO_BOTTOM;
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Robert Ancell (robert-ancell) wrote :

tremu - what version of valac are you using? Could you file a separate bug for this?

tremu (trumeable) wrote :

Now I have compiled it successfully and it works!
With the branch lp:~robert-ancell/simple-scan/fix-pdf-trailer the pdf opens in acroread without warning.
I have finally used valac-0.20 because using valac-0.16 like it says on the README.md failed with the error I said.

Thank you for fixing it!

Changed in simple-scan (Ubuntu Precise):
assignee: nobody → Robert Ancell (robert-ancell)
Changed in simple-scan (Ubuntu Trusty):
assignee: nobody → Robert Ancell (robert-ancell)
Changed in simple-scan (Ubuntu):
assignee: nobody → Robert Ancell (robert-ancell)
Changed in simple-scan:
status: In Progress → Fix Released
milestone: none → 3.13.1
Changed in simple-scan (Ubuntu):
status: Triaged → Fix Released
Changed in simple-scan (Ubuntu):
importance: Critical → High
Changed in simple-scan (Ubuntu Trusty):
importance: Critical → High
Changed in simple-scan (Ubuntu Precise):
status: Triaged → In Progress
Changed in simple-scan (Ubuntu Trusty):
status: Triaged → In Progress
description: updated

Hello Till, or anyone else affected,

Accepted simple-scan into trusty-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/simple-scan/3.12.1-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in simple-scan (Ubuntu Trusty):
status: In Progress → Fix Committed
tags: added: verification-needed
Brian Murray (brian-murray) wrote :

Hello Till, or anyone else affected,

Accepted simple-scan into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/simple-scan/3.4.4-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in simple-scan (Ubuntu Precise):
status: In Progress → Fix Committed

I have tested on Trusty now and it works. I can read my scanned PDF file with Adobe Reader on my Nexus 7 with Android 4.4.

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package simple-scan - 3.12.1-0ubuntu1

---------------
simple-scan (3.12.1-0ubuntu1) trusty; urgency=medium

  * New upstream bugfix release:
    - Correct generation of PDF trailer to conform to the PDF standard
      (LP: #1220826)
 -- Robert Ancell <email address hidden> Thu, 01 May 2014 09:36:56 +1200

Changed in simple-scan (Ubuntu Trusty):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for simple-scan has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package simple-scan - 3.4.4-0ubuntu1

---------------
simple-scan (3.4.4-0ubuntu1) precise; urgency=medium

  * New upstream bugfix release:
    - Correct generation of PDF trailer to conform to the PDF standard
      (LP: #1220826)
 -- Robert Ancell <email address hidden> Thu, 01 May 2014 09:35:32 +1200

Changed in simple-scan (Ubuntu Precise):
status: Fix Committed → Fix Released
Robert Ancell (robert-ancell) wrote :

This SRU is being held back due to errors.ubuntu.com reporting the following:
https://errors.ubuntu.com/problem/bfbab04f67d47647bb54d2d73cf467ba3e8be8fb
https://errors.ubuntu.com/problem/635741abd4abe1a4af7567d197af615e0c005360

These look like standard driver crashes and not related to this patch.

Robert Ancell (robert-ancell) wrote :

Note that simple-scan gets many errors reported due to various SANE driver bugs.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers