You are not logged in.

#1 2013-12-28 19:33:54

Tristelune
Member
Registered: 2007-10-09
Posts: 86

[SOLVED] gscan2pdf produce pdf too small

Hello,

I have a problem with gscan2pdf 1.2.0. First did somebody already installed it and does it works ? My problem is the following:
when I try to produce a pdf, the size of the pdf is reduced. For example if my scan is tangente.jpg I get the following size:

% identify tangente.jpg 
tangente.jpg JPEG 2552x3508 2552x3508+0+0 8-bit sRGB 1.896MB 0.000u
0:00.000

And after OCR and saving as pdf:

% identify test.pdf 
test.pdf PDF 241x331 241x331+0+0 16-bit Bilevel Gray 10.3KB 0.000u
0:00.000

But with djvu everything is fine. If I downgrade to 1.1.3 it doesn't help. Something happens during the saving
as pdf, but I can't find what.

Any idea ? Or just tell me if it works for somebody.

Thanks!

Last edited by Tristelune (2014-02-15 08:48:38)

Offline

#2 2013-12-29 13:33:15

Tristelune
Member
Registered: 2007-10-09
Posts: 86

Re: [SOLVED] gscan2pdf produce pdf too small

I have just discovered something new. Perhaps somebody can reproduce the problem.
I normally scan with the xsane software and then I use
gscan2pdf. In that case I have the problem. I discovered that
if I scan with gscan2pdf, do the ocr and save as pdf everything is fine
if I scan with 300 dpi. If I scan with 75 dpi, there is also a
reduction. If I do the same with simple-scan (300 dpi, scan and do the ocr with gscan2pdf), there is also no problem.
There is a problem with xsane and skanlite. I have not tested other
applications.

Offline

#3 2013-12-30 13:56:07

satanselbow
Member
Registered: 2011-06-15
Posts: 538

Re: [SOLVED] gscan2pdf produce pdf too small

I am struggling to see what your problem is - exactly? If the output pdf malformed or garbage in any way? Are there different results with various ocr backends?

You are scanning a hi resolution graphic format and performing an ocr to extract the text - which will be a considerably smaller file... both in content and filesize... what or where is the actual problem? A 75dpi file would likewise be expected to be considerably smaller filesize when compared to 300dpi due to being a much lower resolution...

You really need to clarify your issue before further sane (sic) assistance will be forthcoming...

Offline

#4 2013-12-30 19:44:31

Tristelune
Member
Registered: 2007-10-09
Posts: 86

Re: [SOLVED] gscan2pdf produce pdf too small

Ok, I'll try to be clearer, just tell me after that if you understand my problem. I want to scan  a page of a magazin (or book, it doesn't matter).
To do the scan I use xsane and I scan at 300 dpi. My goal is to have a searchable pdf. To get it, I take the scanned document and I open it in gscan2pdf.
With gscan2pdf I perform ocr with tesseract. After that I save my document as pdf.
Now the problem. The document I have scanned is saved in jpg format. If I try to print the jpg, it's the same size as the original document, so it's A4.  I
mean here the size of the printed document, not the filesize. After doing an ocr on the jpg and saved as a pdf in gscan2pdf, if I try to print the document, it's
smaller than the original scanned document. I don't know exactly, but I would say smaller than a quarter of A4 (A4/4). So the document doesn't keep the original
size, so A4. There is no problem if I save the document as djvu.
Now if I scan the document with gscan2pdf (at 300 dpi) or simple-scan, do ocr with gscan2pdf and save it as a pdf file and then try to print it, it's the original size A4.
If I do the same with xsane or skanlite, the printed pdf is smaller than A4, so the original size is reduced.

Is it clearer for you ? Do you need more input ?

Offline

#5 2013-12-30 19:46:16

Tristelune
Member
Registered: 2007-10-09
Posts: 86

Re: [SOLVED] gscan2pdf produce pdf too small

Sorry I forgot: the pdf is not malformed or something like that. The only problem is that it doesn't retain it's original size, A4 in my example.

And for the moderator: I wanted to edit my previous post but it didn't work. Sorry for double posting sad.

Last edited by Tristelune (2013-12-30 19:48:24)

Offline

#6 2014-02-14 20:46:07

Tristelune
Member
Registered: 2007-10-09
Posts: 86

Re: [SOLVED] gscan2pdf produce pdf too small

This issue is solved with the following patch:

diff --git a/lib/Gscan2pdf/Page.pm b/lib/Gscan2pdf/Page.pm
index eef6332..b24e786 100644
--- a/lib/Gscan2pdf/Page.pm
+++ b/lib/Gscan2pdf/Page.pm
@@ -222,9 +222,14 @@ sub resolution {
   }

   if ( $self->{resolution} ) {
-   if ( not $image->Get('units') eq 'PixelsPerInch' ) {
+   my $units = $image->Get('units');
+   if ( $units eq 'pixels / centimeter' ) {
     $self->{resolution} *= $CM_PER_INCH;
    }
+   elsif ( not $units eq 'pixels / inch' or $units eq 'undefined' ) {
+    $logger->warn("Unknown units: '$units'.");
+    $logger->warn('The resolution and page size will probably be wrong.');
+   }
    return $self->{resolution};
   }
  }

At the moment it's not integrated. So you have to apply the patch in version 1.2.3.

Thank you for reading!

Offline

Board footer

Powered by FluxBB