simple-scan creates broken PDF's

Reported by Meghan-nicholas on 2011-03-24
30
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Simple Scan
High
Unassigned
simple-scan (Ubuntu)
High
Unassigned

Bug Description

SOLUTION:
...........................................
This is now fixed for 3.1.90.

To fix broken documents run the following:
simple-scan --fix-pdf ~/Documents/*.pdf
...........................................

Binary package hint: simple-scan

A scanned document produces a pdf that can be opened correctly in evince.
When opening the same document using Adobe reader 9.4.2 2/11/2011 an error appears before the document is opened "The file is damaged but is being repaired". After this the document is opened and can be viewed as expected.

When reading the same document on an android mobile phone using adobe reader an error is displayed "the document cannot be opened because it is corrupted or damaged". The mobile version of Adobe reader is 10.0.1 build 37149. The mobile device is an HTC Desire running Android version 2.2.

The scanner is a Canon Pixma MP640 printer/scanner communicating with a laptop over a wifi network.
This problem happens whether I scan as a text document or colour on simple scan.

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: simple-scan 2.32.0-0ubuntu4
ProcVersionSignature: Ubuntu 2.6.35-28.49-generic-pae 2.6.35.11
Uname: Linux 2.6.35-28-generic-pae i686
NonfreeKernelModules: nvidia wl
Architecture: i386
Date: Thu Mar 24 11:10:23 2011
DriverPackageVersions:
 libsane 1.0.21-2ubuntu2
 libsane-extras N/A
 hplip 3.10.6-1ubuntu10.2
 hpoj N/A
EcryptfsInUse: Yes
ExecutablePath: /usr/bin/simple-scan
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
MachineType: Dell Inc. Inspiron 1370
ProcCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.35-28-generic-pae root=UUID=471c0951-7a14-4c87-9987-24f667cfb972 ro quiet splash
ProcEnviron:
 LANG=en_GB.utf8
 SHELL=/bin/bash
SourcePackage: simple-scan
dmi.bios.date: 09/15/2009
dmi.bios.vendor: Dell Inc.
dmi.bios.version: A01
dmi.board.name: 0H5W28
dmi.board.vendor: Dell Inc.
dmi.board.version: A01
dmi.chassis.asset.tag: None
dmi.chassis.type: 8
dmi.chassis.vendor: Dell Inc.
dmi.chassis.version: A01
dmi.modalias: dmi:bvnDellInc.:bvrA01:bd09/15/2009:svnDellInc.:pnInspiron1370:pvrA01:rvnDellInc.:rn0H5W28:rvrA01:cvnDellInc.:ct8:cvrA01:
dmi.product.name: Inspiron 1370
dmi.product.version: A01
dmi.sys.vendor: Dell Inc.

Robert Ancell (robert-ancell) wrote :

Hi,

Could you load the PDF into your version of Acrobat and then save it using File>Save and attach the file?
Also could you try the test.pdf I'm attaching to this report and see if it does the same thing?

I don't get the errors with Adobe reader 10.0.0

Thanks.

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

@Robert
Adobe Reader will not save PDF documents (at least mine won't, and mine is the same version as Meghan's). Adobe Acrobat Professional will, of course, but that's a for-pay program that Meghan might not have.

Hi,
Attached is the pdf using the 'save a copy' option of Adobe 9 (the problem
is still there).
I have opened test.pdf and I get the same error as in scarecrow.pdf.

Thanks, Meghan

On 25 March 2011 02:35, Robert Ancell <email address hidden> wrote:

> Hi,
>
> Could you load the PDF into your version of Acrobat and then save it using
> File>Save and attach the file?
> Also could you try the test.pdf I'm attaching to this report and see if it
> does the same thing?
>
> I don't get the errors with Adobe reader 10.0.0
>
> Thanks.
>
> ** Attachment added: "test.pdf"
>
> https://bugs.launchpad.net/ubuntu/+source/simple-scan/+bug/741628/+attachment/1938833/+files/test.pdf
>
> ** Changed in: simple-scan (Ubuntu)
> Status: New => Incomplete
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/741628
>
> Title:
> simple-scan creates broken PDF's
>
> Status in “simple-scan” package in Ubuntu:
> Incomplete
>
> Bug description:
> Binary package hint: simple-scan
>
> A scanned document produces a pdf that can be opened correctly in evince

@Meghan
Launchpad does not support email attachments. Instead, please come to the bug page (https://bugs.launchpad.net/ubuntu/+source/simple-scan/+bug/741628) and attach the file using the "Add attachment or patch" link near the bottom of the page, or the "Add attachment" link at the bottom of the box on the right side of the page labeled "Attachments".

Attached is the pdf using the 'save a copy' option of Adobe 9. The problem still appears in this copy.
I have opened test.pdf and I get the same error as in scarecrow.pdf.

Launchpad Janitor (janitor) wrote :

[Expired for simple-scan (Ubuntu) because there has been no activity for 60 days.]

Changed in simple-scan (Ubuntu):
status: Incomplete → Expired

@Meghan
Is this bug still occurring?

Since you provided the requested information (with the attachment in https://bugs.launchpad.net/ubuntu/+source/simple-scan/+bug/741628/comments/6), the bug could be changed back to New from Expired (as it could have been changed from Incomplete back to New), provided that it still occurs with the latest package versions.

Robert Ancell (robert-ancell) wrote :

Setting to triaged, I can reproduce this problem..

Changed in simple-scan (Ubuntu):
status: Expired → Triaged
importance: Undecided → High
Changed in simple-scan:
status: New → Triaged
importance: Undecided → High
Robert Ancell (robert-ancell) wrote :

The solution was found by Rafał Mużyło in this bug:
https://bugs.gentoo.org/show_bug.cgi?id=380429

This is now fixed for 3.1.90.

To fix broken documents run the following:
simple-scan --fix-pdf ~/Documents/*.pdf

It should be safe to run this on all PDF documents but PLEASE BACKUP FIRST. It will also copy the existing document to DocumentName.pdf~ so you have those in case anything goes wrong.

If you can't wait for the next simple-scan, you can also run this Python program (i.e. python fixpdf.py broken.pdf > fixed.pdf)
import sys
import re

lines = file (sys.argv[1]).readlines ()

xref_offset = int(lines[-2])

xref_offset = 0
for (n, line) in enumerate (lines):
        # Fix PDF header and binary comment
        if (n == 0 or n == 1) and line.startswith ('%%'):
                xref_offset -= 1
                line = line[1:]

        # Fix xref format
        match = re.match ('(\d\d\d\d\d\d\d\d\d\d) 0000 n\n', line)
        if match != None:
                offset = int (match.groups ()[0])
                line = '%010d 00000 n \n' % (offset + xref_offset)

        # Fix xref offset
        if n == len(lines) - 2:
                line = '%d\n' % (int (line) + xref_offset)

        # Fix EOF marker
        if n == len(lines) - 1 and line.startswith ('%%%%'):
            line = line[2:]

        print line,

Changed in simple-scan (Ubuntu):
status: Triaged → Fix Committed
Changed in simple-scan:
status: Triaged → Fix Released
Launchpad Janitor (janitor) wrote :

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

---------------
simple-scan (3.1.90-0ubuntu1) oneiric; urgency=low

  * New upstream release.
    - Fix broken PDF generation and add a --fix-pdf command line
      option to fix broken PDFs generated by older versions (LP: #741628)
 -- Jeremy Bicha <email address hidden> Fri, 02 Sep 2011 08:07:54 +0200

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

Since 10.04 LTS is still supported, could you backport the fixed version of Simple Scan to 10.04?

Pierre Pietri (pf-pietri) wrote :

With Natty, I try to install simple-scan-1.0.3, and the following occurs:

root@Lutwidge:/home/pierre# cd /home/pierre/Documents/simple-scan.install/simple-scan-1.0.3
root@Lutwidge:/home/pierre/Documents/simple-scan.install/simple-scan-1.0.3# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for library containing strerror... none required
checking whether gcc and cc understand -c and -o together... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
Using config source xml:merged:/etc/gconf/gconf.xml.defaults for schema installation
Using $(sysconfdir)/gconf/schemas as install directory for schema files
checking what warning flags to pass to the C compiler... -Wall -Wmissing-prototypes
checking what language compliance flags to pass to the C compiler...
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for SIMPLE_SCAN... configure: error: Package requirements (
    gtk+-2.0
    gconf-2.0
    gmodule-export-2.0
    gthread-2.0
    cairo
    gdk-pixbuf-2.0
    cairo-pdf
    dbus-glib-1
    gudev-1.0
) were not met:

No package 'gconf-2.0' found
No package 'dbus-glib-1' found
No package 'gudev-1.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables SIMPLE_SCAN_CFLAGS
and SIMPLE_SCAN_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

root@Lutwidge:/home/pierre/Documents/simple-scan.install/simple-scan-1.0.3# make
make: *** Pas de cibles spécifiées et aucun makefile n'a été trouvé. Arrêt.
root@Lutwidge:/home/pierre/Documents/simple-scan.install/simple-scan-1.0.3#

WHAT CAN I DO ???

Is the bug really corrected in Ocelot ?????

@Pierre Pietri

(1) Why are you installing simple-scan 1.0.3? That version is far, far older than any of the versions discussed in this bug, including the version against which this bug was originally reported.

(2) This bug is not a good place to ask for build advice, especially since the task you are trying to perform is not in service of investigating the bug and the version of simple-scan that you are trying to build and install is not the version released to fix the bug. So instead, if you want help building simple-scan, please post a question about it (https://answers.launchpad.net/ubuntu/+source/simple-scan/+addquestion). You can post a link to the question here, but then further discussion of the topic should occur in the question. Please feel free to subscribe me to the question, in which case I'll try to help you myself if nobody else gets around to it before I am able to. It looks to me like the problem is that you don't have the necessary build dependencies installed, such as some -dev packages, but we would have to work on the problem for a bit to be sure.

Pierre Pietri (pf-pietri) wrote :

Dear M. Kagan,

I'm really sorry to offend you in making what seems to you a misplaced post.
(Maybe I offend you also with my awkward English...).

In fact - i f you carefully read the former 2 posts (mine, preceeded by Hugh Redelmeier's one, you'll understand that I just intended to re-install a version from the availibility date of 10.04 (whensimple-scan worked almost perfectly), in response to his sugggestion:

          "could you backport the fixed version of Simple Scan to 10.04?".

This didn't work, and I tried to explain him HOW it didn't work.

Maybe I misunderstood the meaning of "backport the fixed version...".

Anyway, my only aim is - if you read the items in bug 732517 , which is the one I originally posted on 2011-03-10 - my only aim is to obtain that simple-scan works on my Ubuntu 11.04 as well as it used to on 10.04, generating correct pdf files and not suffering from some minor functional and ergonomic regressions that I observed since that time.

Fortunately - thanks to the free softwares rich offer - I could survive during 7 month with alternative products and despite any efficient response from the simple-scan project.

But I really appreciated - just for a few but excyting time - features (ergonomy, graphic capture quality - offered by a certain version of simple-scan. I still hope I will get some satisfaction with coming versions.

I do appreciate your eagerness in answering my post, which means to me that somebody (yourself and Hugh Redelmeier) is still alive and vigilant on the project.

Cheerfully.

eben (ebendavidpekeur) on 2012-02-16
Changed in simple-scan:
assignee: nobody → eben (ebendavidpekeur)
Michael Nagel (nailor) wrote :

Hi eben,

please don't just grab a ticket without a comment :)
What are you up to?

Regards
Michael

eben (ebendavidpekeur) on 2012-02-18
Changed in simple-scan:
assignee: eben (ebendavidpekeur) → nobody
Michael Nagel (nailor) on 2012-06-03
description: updated
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.