locks when trying to save as PDF

Bug #424249 reported by Alexis de Lattre on 2009-09-04
194
This bug affects 36 people
Affects Status Importance Assigned to Milestone
gscan2pdf (Debian)
Fix Released
Unknown
gscan2pdf (Ubuntu)
Undecided
Unassigned
Nominated for Lucid by Felix Zweig
Karmic
Undecided
Unassigned

Bug Description

Binary package hint: gscan2pdf

Under an up-to-date (September 4th 2009) Ubuntu Karmic, I can successfully scan documents with gscan2pdf 0.9.29. But when I make a "Save" to save my scanned document as PDF :
1. it prompts a first dialog box : I select "PDF" as Type of image (which is the default) and I don't change any parameter ; then I click on "Save",
2. I get a second dialog box to give a name to the file ; I put a name and I click "Save" again,
3. I get a box with a progressive bar "Saving page 1 of 1", but this progress bar never ends and always stays on "Saving page 1 of 1"... I have to click on "Cancel" to stop it. The PDF file is created with a zero size.

I don't get any error message in the console during the save process (I started gscan2pdf from a console to try to catch an error message).

Note : Saving the document works fine when I save it as a JPG, GIF, PNG, TIFF or PNM file.

ProblemType: Bug
Architecture: i386
DistroRelease: Ubuntu 9.10
Package: gscan2pdf 0.9.29-1
PackageArchitecture: all
ProcEnviron:
 PATH=(custom, user)
 LANG=fr_FR.UTF-8
 SHELL=/bin/zsh
ProcVersionSignature: Ubuntu 2.6.31-9.29-generic
SourcePackage: gscan2pdf
Uname: Linux 2.6.31-9-generic i686

Related branches

Alexis de Lattre (alexis-via) wrote :
Alexis de Lattre (alexis-via) wrote :

I just found out that this bug was also reported in Debian under n°531213 :

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=531213

Alexis de Lattre (alexis-via) wrote :

I followed the information in the Debian bug report ; I downgraded perlmagic from 7:6.5.1.0-1.1ubuntu3 to the version of Jaunty 6.4.5.4.dfsg1-1ubuntu3.1, and it solved the issue ; I can now save my scanned documents as PDF without problems.

Please start gscan2pdf with the --debug option, reproduce the problem, and
post the output from the command line.

Alexis de Lattre (alexis-via) wrote :

Here are the logs with the perlmagic package available in Karmic, when gscan2pdf can't save the PDF document. I have added some comments in the logs between << >>.

Unfortunately, the logs won't give you much information, as the error is probably in the forked process.

Alexis de Lattre (alexis-via) wrote :

Just a quick note to say that the bug is still present in current Karmic Koala (September 24th, 2009) and still 100% reproductible. I got it again today on another PC with another scanner. Downgrading perlmagic to the version in jaunty still solves the issue.

Robert Hrovat (robi-hipnos) wrote :

Same here. PDF cannot be saved with gscan2pdf on karmic :-(

Changed in gscan2pdf (Debian):
status: Unknown → Incomplete
Martin Farrell (fazzuk) wrote :

To confirm, I'm experiencing the same bug in a fully up to date Karmic Koala (20 October 2009).

The same Problem here. Up2date Ubuntu 9.10
Can't save my scans.

How can i fix the problem?
I tried the following:
sudo aptitude install perlmagick=6.4.5.4.dfsg1-1ubuntu3.1
But i get only a ...can't find version 6.4.5.4.dfsg1-1ubuntu3.1

How can i know the right package version to downgrade?

sheen7334 (jay-ejsheen) wrote :

I have experienced the same problem, having just now upgraded from jaunty to karmic.

I cannot reproduce this on my karmic box. Please start gscan2pdf with
the --debug option, reproduce the problem, and post the output from
the command line, noting which compression type you chose.

sheen7334 (jay-ejsheen) wrote :

Hung -
Here is the output from debug as it sits hanging

Setting option 11 on SANE_Handle 184957040
Setting option 11 on SANE_Handle 184957040
$VAR1 = [];
rotate facing 0
rotate reverse 0
non-duplex mode
rotate_facing 0
rotate_reverse 0
unpaper 1
OCR
Running sane_start for SANE_Handle 184957040
Getting parameters for SANE_Handle 184957040
gscan2pdf: scanning image of size 1648x2196 pixels at 1 bits/pixel
gscan2pdf: acquiring gray frame
gscan2pdf: read 452376 bytes in total
Scanned page /tmp/X61lNmsL3d/out1.pnm. (scanner status = 5)
Importing /tmp/X61lNmsL3d/out1.pnm, format Portable anymap
Added /tmp/X61lNmsL3d/zY3gYj2WOE.pnm at page 1 with resolution 72
unpaper --output-pages 1 --white-threshold 0.9 --layout single --black-threshold 0.33 --deskew-scan-direction left,right --overwrite --input-file-sequence /tmp/X61lNmsL3d/zY3gYj2WOE.pnm --output-file-sequence /tmp/X61lNmsL3d/76YNLfbfcv.pnm ;
Forked PID 17208
Processing sheet: /tmp/X61lNmsL3d/zY3gYj2WOE.pnm -> /tmp/X61lNmsL3d/76YNLfbfcv.pnm
Waiting to reap process at /usr/bin/gscan2pdf line 8825.
Reaped PID 0
Forked PID 17330

The dialog box for saving shows a partial save and just sits there.

sheen7334 (jay-ejsheen) wrote :

The above happened when I tried to save as a pdf. Saving as a gif worked and gave me this output in debug mode

unpaper --output-pages 1 --white-threshold 0.9 --layout single --black-threshold 0.33 --deskew-scan-direction left,right --overwrite --input-file-sequence /tmp/X61lNmsL3d/W0gz37yP8D.pnm --output-file-sequence /tmp/X61lNmsL3d/ZhfSYpZNgZ.pnm ;
Forked PID 21338
Processing sheet: /tmp/X61lNmsL3d/W0gz37yP8D.pnm -> /tmp/X61lNmsL3d/ZhfSYpZNgZ.pnm
Waiting to reap process at /usr/bin/gscan2pdf line 8825.
Reaped PID 0
convert /tmp/X61lNmsL3d/ZhfSYpZNgZ.pnm -density 72 '/home/jay/documents/test.gif'

If it helps, there is a 'test.pdf' file created from the message I left earlier but it is corrupted or incomplete or only a placeholder or ?

Jay

On Fri, Oct 30, 2009 at 04:13:41PM -0000, sheen7334 wrote:
> The dialog box for saving shows a partial save and just sits there.

What type of compression were you trying to use?

Martin Farrell (fazzuk) wrote :

Hi Jeffrey

This is what I'm trying to save:

Image type - PDF
Downsample to - 50dpi
Compression - JPEG
JPEG Quality - 84

I get the 'Saving PDF....' dialog box and the progress bar goes half way of the 'Saving page 1 of 1' and then it hangs.

After a while I hit cancel and then quit the application without saving.

Attached is the output from gscan2pdf --debug

Thanks for your help.

sheen7334 (jay-ejsheen) wrote :

My compression is set to "automatic"

Fixerdave (fixerdave) wrote :

Here's an interesting bit to add:

I scanned a 3-page document (greyscale), but, as per this bug, couldn't save as a PDF. So, I saved it as jpg (3 separate images). Then, after exiting and going back in to gscan2pdf, I created a new document (project?) and imported those 3 pages. This saved as PDF just fine.

Somehow, the act of scanning is mucking up gscan2pdf. Importing instead of scanning (the exact same images scanned earlier) will bypass the bug and allow saving to pdf.

It's at least an easy work-around.

Hope this helps,

   David...

Just to confirm - same problem here on Ubuntu 9.10. But reimporting the scanned images and saving then actually works out. Thanks for that hint, David!

sheen7334 (jay-ejsheen) wrote :

tough work around when your setup is automated. separate images won't work when i am using the adf for multipage documents.

Stinger (e-mindahl) wrote :

Confirming bug
Ubuntu 9.10 Amd64bit version.
Attached debug.

Dan Darwood (darwoodster) wrote :

hey guys, i've had the same problem, i googled it and found this

http://ubuntuforums.org/showpost.php?p=8145111&postcount=6

I added his repo, updated the magick packages and it all works now :)

Hope this helps,

Dan

Stinger (e-mindahl) wrote :

As far as I can tell the bug is related to imagemagick and has been fixed in debian version 7:6.5.5.3-1
See Debian bug #548261 or the Ubuntu bug #455740.

If I'm right we can only wait for the new imagemagick to appear in Ubuntu or use the workarounds mentioned above.

Stinger (e-mindahl) wrote :

Sorry here is the correct link to the Debian bug:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548261

Stinger (e-mindahl) wrote :

I'm having trouble scanning and saving as djvu-file too.
But if I save as tiff and import the tiff again I can save as djvu.
Could this be related ? Does gscan2pdf use imagemagick to convert to djvu?
Or do I need to open another bug report ?

On Thu, Nov 05, 2009 at 07:13:57PM -0000, Stinger wrote:
> I'm having trouble scanning and saving as djvu-file too.
> But if I save as tiff and import the tiff again I can save as djvu.
> Could this be related ? Does gscan2pdf use imagemagick to convert to djvu?
> Or do I need to open another bug report ?

The procedure for saving as a PDF depends on which compression method
is chosen:

None - whatever format the image is in, typically PNM from the scanner
Any other, i.e. JPEG, PNG, TIFF, etc. - if the image is not already in
that format, then IM is used to convert.

For DjVu, IM used to convert the image to either PNM, TIFF or JPG and the DjVu tools are
used to convert from DjVu.

i.e. TIFF->DjVu or scanner (PNM) to DjVu should not involve IM.

Please start gscan2pdf with the --debug option, scan, try to save as
DjVu, and post the output from the command line.

sheen7334 (jay-ejsheen) wrote :

Saving to DjVu hangs - output of debug below.

Running sane_start for SANE_Handle 187083776
Getting parameters for SANE_Handle 187083776
gscan2pdf: scanning image of size 1648x2196 pixels at 1 bits/pixel
gscan2pdf: acquiring gray frame
gscan2pdf: read 452376 bytes in total
Scanned page /tmp/VRJq3P0I0T/out1.pnm. (scanner status = 5)
Importing /tmp/VRJq3P0I0T/out1.pnm, format Portable anymap
Added /tmp/VRJq3P0I0T/JHLLxXZ4yb.pnm at page 1 with resolution 72
Running sane_start for SANE_Handle 187083776
Getting parameters for SANE_Handle 187083776
gscan2pdf: scanning image of size 1648x2196 pixels at 1 bits/pixel
gscan2pdf: acquiring gray frame
gscan2pdf: read 452376 bytes in total
Scanned page /tmp/VRJq3P0I0T/out2.pnm. (scanner status = 5)
Importing /tmp/VRJq3P0I0T/out2.pnm, format Portable anymap
Added /tmp/VRJq3P0I0T/FJ3XqY6OZn.pnm at page 2 with resolution 72
Forked PID 5691

sheen7334 (jay-ejsheen) wrote :

thanks for the help Dan. Worked for me too.

Stinger (e-mindahl) wrote :

Hi here is the debug from:

1. scan and save as djvu

Stinger (e-mindahl) wrote :

and here:

2. import tiff and save as djvu

question to Dan and sheen7334.
does the workaround work for scanning and saving to djvu too ?

VveganmoltovV (greggahorton) wrote :
Download full text (13.4 KiB)

here is my output from debug, hangs at the same point:
$ gscan2pdf --debug
gscan2pdf 0.9.29
Using en_US.UTF-8 locale
Running init
Running sane_init
Gtk2-Perl version 1.221
Built for 2.18.2
Running with 2.18.3
Using GtkImageView version 1.6.1
Using Gtk2::ImageView version 0.05
Using PDF::API2 version 0.73
$VAR1 = {
          'ocr panel' => '527',
          'frontend' => 'libsane-perl',
          'Paper' => {
                       'US Legal' => {
                                       'l' => '0',
                                       'y' => '356',
                                       'x' => '216',
                                       't' => '0'
                                     },
                       'US Letter' => {
                                        'l' => '0',
                                        'y' => '279',
                                        'x' => '216',
                                        't' => '0'
                                      },
                       'A4' => {
                                 'l' => '0',
                                 'y' => '297',
                                 'x' => '210',
                                 't' => '0'
                               }
                     },
          'unsharp radius' => '0',
          'ocr engine' => 'gocr',
          'window_maximize' => '1',
          'keywords' => '',
          'layout' => 'single',
          'cwd' => '/home/frenzy',
          'unsharp amount' => '1',
          'OCR output' => 'replace',
          'image type' => 'pdf',
          'OCR on scan' => '1',
          'Page range' => 'all',
          'subject' => '',
          'default' => {
                         'hpaio:/usb/PSC_2350_series?serial=MY55IF53N8KJ' => {
                                                                               'br-x' => '210'
                                                                             }
                       },
          'window_height' => '690',
          'startup warning' => '1',
          'rotate reverse' => '0',
          'Dark threshold' => '0.12',
          'pages to scan' => '1',
          'Blank threshold' => '0.005',
          'title' => 'test',
          'unpaper on scan' => '1',
          'rotate facing' => '0',
          'cache options' => '1',
          'libsane-perl version' => '0.03',
          'author' => '',
          'downsample dpi' => '150',
          'window_width' => '1014',
          'window_x' => '0',
          'threshold tool' => '80',
          'window_y' => '25',
          'quality' => '75',
          'date offset' => '0',
          'unsharp sigma' => '1',
          'thumb panel' => '100',
          'version' => '0.9.29',
          'device' => '',
          'scan prefix' => '',
          'unsharp threshold' => '0.05',
          'SANE version' => '1.0.20',
          'downsample' => '',
          'restore window' => '1',
          'pdf compression' => 'auto'
        };
Found Image::Magick
Found ImageMagick
Found scanadf
Found xdg-email
Found gocr
Found tesseract
Found cjb2 (djvu)
Found unpaper
Found libtiff
Using /tmp/unehGbe6W1 for temporary files
Running sane_get_devices
$VAR1 = [];
*** unhandled e...

Stinger (e-mindahl) wrote :

Please dont add debug information as comments, please use "Add an attachment" instead.

sheen7334 (jay-ejsheen) wrote :

> question to Dan and sheen7334.
> does the workaround work for scanning and saving to djvu too ?

Yes, it does tiff-djvu

Stinger (e-mindahl) wrote :

Thanks sheen7334, as I see it the bug is related to the Imagemagick packages.
I just bit the bullet myself and used the workaround proposed by Dan.

It seems to work, I can now scan and save as djvu , scan and save as pdf if I use automatic or jpeg compression but not if I use G3 or G4 tiff compression.
Gscan2pdf used to work with the tiff compressions when making a pdf, but if this error is due to the packages in the workaround or due to something else I cant tell.
By selecting automatic as compression I get a very small pdf too.

The packages in the workaround involves:

imagemagick
libmagickcore2
libmagickwand2
pearlmagick

Rudiger Wolf (rudiger-wolf) wrote :

I also have this problem in Karmic 9.10 AMD64. Cannot save as PDF, can save as Tiff.
Have attached debug output. Hope it helps to resolve issue this is such a great program.

It is definitely an ImageMagick problem. The trouble is that I cannot
reproduce it here. In order to allow the ImageMagick maintainers to
reproduce it, we've got to give them a test image that doesn't convert.

gscan2pdf stores the scanned images by default in a temporary
directory it creates in /tmp.

Having reproduced the problem, copy the problem image from the
temporary directory (otherwise gscan2pdf will delete it next time it
closes), and reproduce the problem after IMPORTING the image, rather
than scanning it.

Post the image here, naming the type of compression you were trying to
use in the PDF.

Nicholas Hatch (nickhatch77) wrote :

Hello,

Just as a confirmation/contribution, I followed the steps in Dan's post (#22):

http://ubuntuforums.org/showpost.php?p=8145111&postcount=6

When I attempted to save multipages to PDF, the application would freeze. After running the updates mentioned in the link, everything worked fine.

VveganmoltovV (greggahorton) wrote :

this worked for me too, we should consider this the fix?

Nicholas Hatch wrote:
> Hello,
>
> Just as a confirmation/contribution, I followed the steps in Dan's post
> (#22):
>
> http://ubuntuforums.org/showpost.php?p=8145111&postcount=6
>
> When I attempted to save multipages to PDF, the application would
> freeze. After running the updates mentioned in the link, everything
> worked fine.
>
>

Richard Potter (rpotter) wrote :

No... this is a workaround. Big difference.

Rudiger Wolf (rudiger-wolf) wrote :

Attached is a temp file copied from /tmp created by gscan2pdf and trying to save scanned image as PDF with LZW compression.

Alexis de Lattre (alexis-via) wrote :

As I explained in my comment n°9 in bug #455740, the present bug is NOT a duplicate of bug #455740 ! Could someone with the appropriate crendentials unlink the two bugs ? Thanks !

Martin Pitt (pitti) wrote :

Sorry for the misunderstanding. Unduping.

Stinger (e-mindahl) wrote :

Confirming sixela.
and here are my results:

1) on a amd64 Karmic with imagemagick+perlmagick+libmagickcore1+libmagickwand1 in version 7:6.4.5.4.dfsg1-1ubuntu4
   - I CAN save PDFs and Djvu in gscan2pdf.

2) on a amd64 Karmic with imagemagick+perlmagick+libmagickcore2+libmagickwand2 in version 7:6.5.1.0-1.1ubuntu3
   - I can't save PDFs and Djvu in gscan2pdf.

3) on a amd64 Karmic with imagemagick+perlmagick+libmagickcore2+libmagickwand2 in version 7:6.5.5.3-1ubuntu1
    ( from Lucid )
   - I can't save PDFs and Djvu in gscan2pdf.

If I lock the perlmagick package to version 7:6.4.5.4 and only upgrade the imagemagick+libmagickcore+libmagickwand packages:

1) on a amd64 Karmic with imagemagick+libmagickcore2+libmagickwand2 in version 7:6.5.1.0-1.1ubuntu3
   - I CAN save PDFs and Djvu in gscan2pdf.

2) on a amd64 Karmic with imagemagick+libmagickcore2+libmagickwand2 in version 7:6.5.5.3-1ubuntu1
   - I CAN save PDFs and Djvu in gscan2pdf.

Meaning the bug is with gscan2pdf when it interacts with the perlmagick package.
But we need to isolate the bug to gscan2pdf or to perlmagick.
Instructions needed please ?

If it's a perlmagick problem, it's still a imagemagick bug.

Could the bug be related to introducing openmp ? as posted in comment #22 by Dan.

Stephen (sjd-sedberghschool) wrote :

Added to the bottom of .gscan2pdf within home directory...

resolution = 200

Stephen (sjd-sedberghschool) wrote :

oh and by the way it fixed my problem!

Stinger (e-mindahl) wrote :

Sorry strike the section about:

>"If I lock the perlmagick package to version 7:6.4.5.4 and only upgrade the imagemagick+libmagickcore+libmagickwand >packages:
>
>1) on a amd64 Karmic with imagemagick+libmagickcore2+libmagickwand2 in version 7:6.5.1.0-1.1ubuntu3
> - I CAN save PDFs and Djvu in gscan2pdf.
>
>2) on a amd64 Karmic with imagemagick+libmagickcore2+libmagickwand2 in version 7:6.5.5.3-1ubuntu1
> - I CAN save PDFs and Djvu in gscan2pdf.
>Meaning the bug is with gscan2pdf when it interacts with the perlmagick package.
>But we need to isolate the bug to gscan2pdf or to perlmagick.
>Instructions needed please ?
>
>If it's a perlmagick problem, it's still a imagemagick bug."

Seems that version 7:6.4.5.4 is NOT overwritten when upgrading the packages so what I ended up with was both versions side by side and gscan2pdf was still using version 7:6.4.5.4.

Stinger (e-mindahl) wrote :

Here is an image from /temp that wont convert with version 7:6.5.1.0-1.1ubuntu3 and 7:6.5.5.3-1ubuntu1.
But it will convert using version 7:6.4.5.4.dfsg1-1ubuntu4.

Stinger (e-mindahl) wrote :

Works for me too :-)
Tried with other resolutions
resolution = 300
resolution = 500
Works too

2009/11/17 Stephen <email address hidden>

> Added to the bottom of .gscan2pdf within home directory...
>
> resolution = 200
>
> --
> locks when trying to save as PDF
> https://bugs.launchpad.net/bugs/424249
> You received this bug notification because you are a direct subscriber
> of the bug.
>

On Tue, Nov 17, 2009 at 09:22:49AM -0000, Stinger wrote:
> But we need to isolate the bug to gscan2pdf or to perlmagick.
> Instructions needed please ?

I can't reproduce this, but if someone can by IMPORTING an image, post
the image, and I'll write the shell or perl script to be able to
reassign it to the Imagemagick or Perlmagick packages.

Stinger (e-mindahl) wrote :

I can only reproduce this by scanning and saving as pdf or djvu.
When gscan2pdf locks, I have tried to delete the scanned image and importing another pnm but that's not possible, I have to close gscan2pdf, open it again then I can import and convert the pnm.
version 7:6.5.1.0-1.1ubuntu3 was used.

I'll try your script Jeffrey :-)
Thanks for a very usefull application (hope I haven't offended you in anyway)

Ps.
This is the easiest workaround / solution so far:

Added to the bottom of .gscan2pdf within home directory...
resolution = 200

Posted by stephen #44

FiReSTaRT (dlyh) wrote :

Just a note that the solution from comment #22 worked for me as well. Karmic 64, clean install

ronkinoz (ronkbox-launchpad) wrote :

Just a note that on my Karmic 32 system, this bug also affects cropping of scanned images, and that cropping can also be fixed with Stephen's work around detailed in comment #44.

On Tue, Nov 17, 2009 at 07:34:51PM -0000, Stinger wrote:
> Here is an image from /temp that wont convert with version 7:6.5.1.0-1.1ubuntu3 and 7:6.5.5.3-1ubuntu1.
> But it will convert using version 7:6.4.5.4.dfsg1-1ubuntu4.
>
> ** Attachment added: "6ktXmIYNax.tar.gz"
> http://launchpadlibrarian.net/35796134/6ktXmIYNax.tar.gz

I missed this before. Sorry for not following it up.

Are you saying that if you extract the two PNMs from the tarball and
import them into gscan2pdf, gscan2pdf hangs when producing the PDF?

Does the following also hang (wXfNHp9jXW.pnm is one of the two PNMs):

convert wXfNHp9jXW.pnm wXfNHp9jXW.tif

?

Stinger (e-mindahl) wrote :

2009/11/25 Jeffrey Ratcliffe

>
> Are you saying that if you extract the two PNMs from the tarball and
> import them into gscan2pdf, gscan2pdf hangs when producing the PDF?
>
> Does the following also hang (wXfNHp9jXW.pnm is one of the two PNMs):
>
> convert wXfNHp9jXW.pnm wXfNHp9jXW.tif
>
> ?
>

I'm afraid the answer is no.
The images will convert just fine when they are imported and converted.
gscan2pdf only hangs when I scan and convert.

But what is different when I scan and convert ?
Tthe image is exactly the same when I import and convert.

The two workarounds in comment #22 and #44 both works for me but are quite
different in approach.
The last mentions the resolution option in ".gscan2pdf" in your home
directory, the first is about "openmp"

Could it be something like gscan2pdf not handing over the resolution
properly when openmp is used in imagemagick? only when scanning ofcourse.

My box is a dualcore amd64
What is yours Jeffrey ?

Had the same problem with hung PDF saves from scanning, using Stephen's fix from comment #44 fixed it.

Just add this one line to .gscan2pdf and now saving PDFs works great.

resolution = 200

pepegnu (pepegnu) wrote :

Confirm for the fix in #44. Adding

resolution = 150

at the bottom of ~/.gscan2pdf worked fine for me.

Pm (pmichaud) wrote :

Just confirming that I also experienced the bug, and that the fix in #56 (resolution = 150) solved the problem for me. I tried (resolution = 200) earlier but that didn't work.

Pm

I have experienced the same problems as noted above.

Here is what I did to work around.

1. I installed the imagemagick-6.5.8.3 source package, generated the .deb using prevu, and installed the resulting package on Karmic Koala on an amd-64 PC. My packages have version number 6.5.8.3-1~9.10prevu1.

2. I ran gscan2pdf with the new package and experienced the same hanging at 50% on saving to PDF.

3. I deleted my ~/.gscan2pdf file and re-ran gscan2pdf. This time, I was able to save successfully to PDF. Interestingly, the progress dialog on saving still hung at 50% but then very rapidly concluded the action and disappeared.

4. Note: on scanning lineart, there is no compression and indeed no choice for compression other than "none". On scanning grayscale, I chose no compression again.

In sum, changing the imagemagick suite to the latest on the Debian/Ubuntu source repositories and removing the old ~/.gscan2pdf file did the trick.

I am happy to provide more information if I am told what to send. I would love to see this bug squashed: gscan2pdf is such a good package.

Thank you for your efforts.

I have finally managed to reproduce the problem, and I think I've cracked it.

Just adding

resolution = 150

or something similar will work fine until you try and print the PDF that you have produced, and see that the paper size is incorrect (unless you really did scan at 150dpi).

Therefore, please try the attached patch, which should apply cleanly to v0.9.29.

Changed in gscan2pdf (Ubuntu):
status: New → Confirmed
Changed in gscan2pdf (Debian):
status: Incomplete → Fix Released

On Wed, Jan 13, 2010 at 12:30:42PM -0000, Jeffrey Ratcliffe wrote:
> Therefore, please try the attached patch, which should apply cleanly to
> v0.9.29.

Here's the patched .deb.

Please test it and let me know if this fixes things.

Changed in gscan2pdf (Ubuntu):
status: Confirmed → Fix Committed

@ Jeffrey Ratcliffe: It's working for me, thanks!

Ilya Barygin (randomaction) wrote :

Jeffrey, thank you for providing the fix.

According to comments in the Debian bug, the problem goes away with imagemagick 7:6.5.7.8-1, so no fix should be required for Lucid (Lucid has imagemagick 7:6.5.7.8-1ubuntu1). Is this correct?

If the patch here is targeted for Karmic, please follow the steps in https://wiki.ubuntu.com/StableReleaseUpdates#Procedure . Where it says "upload the fixed package", please instead attach the debdiff to this bug report and re-subscribe ubuntu-universe-sponsors (I'm unsubscribing u-u-s now).

Rudiger Wolf (rudiger-wolf) wrote :

Working for me on Ubuntu 9.10/Karmic 64 bit.
Installed gscan2pdf_0.9.29-1ubuntu1_all.deb.
Scanned page.
Saved as PDF.

Thank you very much! Great program.

It works in Kubuntu 9.10 with

gscan2pdf 0.9.29-1ubuntu1~9.10prevu1
imagemagick 7:6.5.8.3-1~9.10prevu1

both combined from source packages using prevu.

One curious observation though: there is no warning before an existing file is overwritten by a new scanned file, saved as a PDF.

Thank you.

On Sun, Jan 24, 2010 at 07:01:23PM -0000, Ilya Barygin wrote:
> According to comments in the Debian bug, the problem goes away with
> imagemagick 7:6.5.7.8-1, so no fix should be required for Lucid (Lucid
> has imagemagick 7:6.5.7.8-1ubuntu1). Is this correct?

No. I think that there are two different bugs here that are showing
themselves in the same way. Unfortunately, I have, to date, not been
able to reproduce the problem with imagemagick, but for those for whom
the workaround adding the resolution=... in the .gscan2pdf (which was,
as I explained before, not a good workaround), this bug would still be present.

> If the patch here is targeted for Karmic, please follow the steps in
> https://wiki.ubuntu.com/StableReleaseUpdates#Procedure . Where it says
> "upload the fixed package", please instead attach the debdiff to this
> bug report and re-subscribe ubuntu-universe-sponsors (I'm unsubscribing
> u-u-s now).

Yup, that was my plan. I am the Debian maintainer, but I guessed that
you would prefer an Ubuntu-specific release, especially as I was
hoping to fix this in unstable and testing with a new upstream release
with a load of other changes.

The bug affects only those using the libsane-perl frontend in
gscan2pdf, but it completely prevents them from saving PDFs or DjVu
files until the resolution is specified internally.

The workaround suggested previously in this bug report does this for a
fixed resolution, which will be wrong if a different one is used for
scanning. A better workaround would be to use the scanimage frontend
in gscan2pdf.

This fix works by updating the internal resolution variable with that
used during the scan process.

The patch has been applied upstream and will be included in the
upcoming 0.9.30 release.

To reproduce the bug, delete the ~/.gscan2pdf file, start gscan2pdf,
set the frontend in Edit/Preferences to libsane-perl, scan, and try to
save as PDF or DjVu.

I can't see any potential for regressions, as the patch is tiny -
there are more changes to the Debian packaging to make it
lintian-clean than to the application itself.

In the attached debdiff, I have again slightly refined the packaging
compared, but the patch itself is identical.

Regards

Jeff

Ilya Barygin (randomaction) wrote :

> No. I think that there are two different bugs here that are showing
> themselves in the same way. Unfortunately, I have, to date, not been
> able to reproduce the problem with imagemagick, but for those for whom
> the workaround adding the resolution=... in the .gscan2pdf (which was,
> as I explained before, not a good workaround), this bug would still
> be present.

Generally, before a stable release is updated, the problem should be first resolved in the development release. So, is there something that needs to be fixed in Lucid, and if so, what's the plan?

If there is another issue which still needs to be dealt with in both
Karmic and Lucid, it's ok, and I think a separate report should be
opened for it.

On Tue, Jan 26, 2010 at 11:43:51PM +0300, Ilya Barygin wrote:
> Generally, before a stable release is updated, the problem should be first resolved in the development release. So, is there something that needs to be fixed in Lucid, and if so, what's the plan?

No. The imagemagick issues have already been fixed.

If you want to upload the patched version to Lucid and let people
test there first, please be my guest.

> If there is another issue which still needs to be dealt with in both
> Karmic and Lucid, it's ok, and I think a separate report should be
> opened for it.

No.

As you see, a couple of people have already tested the patch here. I
would upload to both Lucid and Karmic. I hope to have a new upstream
version for Lucid (via unstable) in the next couple of weeks.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gscan2pdf - 0.9.29-1ubuntu1

---------------
gscan2pdf (0.9.29-1ubuntu1) lucid; urgency=low

  [ Jeffrey Ratcliffe ]
  * Note resolution from libsane-perl frontend
    LP: #424249 (locks when trying to save as PDF)
  * Switch to dh7
  * Bumped standards (no changes needed)
  * Added ${misc:Depends}
  * Patched the clean target to fix FTBFS

  [ Ilya Barygin ]
  * debian/rules: install upstream changelog.
 -- Jeffrey Ratcliffe <email address hidden> Fri, 22 Jan 2010 10:33:43 +0100

Changed in gscan2pdf (Ubuntu):
status: Fix Committed → Fix Released
Ilya Barygin (randomaction) wrote :

Uploaded to Lucid. Upstream changelog was lost in the process, so I added an override for it. I also changed the target release to Lucid and mangled the Maintainer field.

Ilya Barygin (randomaction) wrote :

Subscribed ubuntu-sru to get their opinion.

On Tue, Jan 26, 2010 at 10:22:36PM -0000, Ilya Barygin wrote:
> Uploaded to Lucid. Upstream changelog was lost in the process, so I
> added an override for it. I also changed the target release to Lucid and
> mangled the Maintainer field.

When do you think it can be uploaded to Karmic? IMO, this is a serious
bug that would prevent a new user from saving new scans - the raison
d'etre for the software.

Regards

Jeff

Ilya Barygin (randomaction) wrote :

> When do you think it can be uploaded to Karmic? IMO, this is a serious
> bug that would prevent a new user from saving new scans - the raison
> d'etre for the software.

As soon as SRU team acks the upload. For stable release, I would
suggest a debdiff with no packaging changes, with only the patch
necessary, applied inline. (Even at the cost of making lintian a bit
unhappy.) Do you think you can prepare such debdiff? (In the changelog,
version number should be 0.9.29-1ubuntu0.1, target release should be
karmic-proposed.)

I'm sorry if this sounds like bureaucracy to you, but as you see,
during major changes mistakes are easier to make, so changes to stable
release should be as small as possible.

On Wed, Jan 27, 2010 at 12:23:10PM +0300, Ilya Barygin wrote:
> As soon as SRU team acks the upload. For stable release, I would
> suggest a debdiff with no packaging changes, with only the patch
> necessary, applied inline. (Even at the cost of making lintian a bit
> unhappy.) Do you think you can prepare such debdiff? (In the changelog,
> version number should be 0.9.29-1ubuntu0.1, target release should be
> karmic-proposed.)

Attached.

John Dong (jdong) wrote :

ACK from the SRU team for the above debdiff!

Ilya Barygin (randomaction) wrote :

Uploaded to karmic-proposed.

Accepted gscan2pdf into karmic-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in gscan2pdf (Ubuntu Karmic):
status: New → Fix Committed
tags: added: verification-needed
Christian Loos (cloos) wrote :

I updated gscan2pdf from karmic-proposed and I can safe the scan as pdf without any error.

Martin Pitt (pitti) on 2010-02-05
tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gscan2pdf - 0.9.29-1ubuntu0.1

---------------
gscan2pdf (0.9.29-1ubuntu0.1) karmic-proposed; urgency=low

  * Note resolution from libsane-perl frontend
    LP: #424249 (locks when trying to save as PDF)
 -- Jeffrey Ratcliffe <email address hidden> Fri, 22 Jan 2010 10:33:43 +0100

Changed in gscan2pdf (Ubuntu Karmic):
status: Fix Committed → Fix Released
Alexis de Lattre (alexis-via) wrote :

It's working great with the new gscan2pdf package for Karmic. Thanks guys for the fix !

Alexis

Kent57 (kent5700) wrote :

Problem still exists for me in Kubuntu Karmic with the latest packages for gscan2pdt-0.9.29-1ubuntu0.1(all) & imagemagick-0.7:6.5.1.0-1.1ubuntu3(i386).
gscan2pdf will not produce PDF file. It stalls at "saving 1 of 1" unless file in first saved as TIFF then imported into a new file.
Any ideas?

jajodo (jajodo3) wrote :

Same. Using Mint 9. Based on lucid. Stalls saving pdf.... no joy. Can save some other file types.

same problem in actual Version...

@ML: which version are you using?

I don't know if it is the SAME bug, but gscan2pdf always freezes when saving PDFs. Using Kubuntu 14.04, gscan2pdf 1.2.3-1 and perlmagick 8:6.7.7.10-6ubuntu2. I've attached an scan2pfd --debug text output.

The message bellow caught my attention:
"Use of uninitialized value in division (/) at /usr/share/perl5/Gscan2pdf/Document.pm line 1767.
Thread 1 terminated abnormally: Illegal division by zero at /usr/share/perl5/Gscan2pdf/Document.pm line 1767."

Line 1767 is the first non-comment line in this block:
# Get the size and resolution. Resolution is dots per inch, width
# and height are in inches.
my $w = $image->Get('width') / $pagedata->{resolution};
my $h = $image->Get('height') / $pagedata->{resolution};
$pagedata->{w} = $w;
$pagedata->{h} = $h;

Some more comments:
1. My scanner is an Fujitsu 1300 ADF. The automatic document feed and multipage PDF support is the reason I'm using gscan2pdf instead of Skanlite or Simple-Scan (my hardware works with those programs, but they're very limited).
2. I've tried the workaround of adding "resolution = 600" (or whatever) in the end of ~/.gscan2pdf, to no avail.
3. I've uninstalled the default Trusty version of gscan2pdf and installed the package "gscan2pdf_1.2.3-0~ppa1saucy_all.deb" from the PPA jeffreyratcliffe/ppa. Didn't solve the bug, so I've reinstalled the default version.
4. I can save the scan results as a series of .PNG images, without problem.
5. I've tried to save as djvu, but cjb2 returned the error "ERROR - Error writing image for page 2 of DjVu (process returned 2560, image size 0)".

The resolution problems should finally have been fixed in v1.2.5

Can you confirm this?

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

Other bug subscribers

Patches

Remote bug watches

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