Discussion:
[gs-bugs] [Bug 698737] - Ghostscript - A4 PDF to G4 TIFF conversion gives me a 431x210 TIFF
b***@artifex.com
2017-11-13 14:36:45 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698737

--- Comment #4 from Ken Sharp <***@artifex.com> ---
(In reply to Daniel Bautista from comment #3)
Yes, the use of -dUseCropBox solves the problem.
Question: is it safe using -dUseCropBox with other PDFs, even if these PDFs
have no CropBox?
Depends what you mean by 'safe'. If there's no CropBox then Ghostscript will
simply fall back to using the MediaBox.
In other words, is something like this suitable to convert any PDF into a
TIFF A4?
Again, depends what you mean by 'suitable'. You will get a TIFF file which is
1654 by 2338 pixels (A4 at 200 dpi). If the content of the PDF file does not
fit into that area, then it will be cropped.
--
You are receiving this mail because:
You are the QA Contact for the bug.
b***@artifex.com
2017-11-13 14:39:44 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698737

--- Comment #5 from Daniel Bautista <***@duocom.es> ---
OK. That's what I'm looking for.

Thank you very much!
--
You are receiving this mail because:
You are the QA Contact for the bug.
b***@artifex.com
2017-11-13 13:42:10 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698737

Ken Sharp <***@artifex.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED

--- Comment #2 from Ken Sharp <***@artifex.com> ---
The PDF file does not have a Media size of A4. The MediaBox is given as:

/MediaBox [ 0 0 595 1224 ]

which is 8.26x17 inches. The reason Acrobat shows it as A4 is because it has a
CropBox:

/CropBox [ 0 381.600006 595.299988 1224.09998 ]

So the lower portion of the page (bottom 5.3 inches) is cropped off by the
CropBox. The resulting Box is 8.26x11.7 inches. Ghostscript defaults to the
MediaBox, not the CropBox. If you want to use the CropBox instead you must
supply -dUseCropBox.
If I use -dFIXEDMEDIA the result is an A4 TIFF, but it's all blank (like
it's only taking the bottom half of the page).
-dFIXEDMEDIA simply prevents the input from changing the media size. The
content is not scaled it is simply placed on the media. If you want the content
scaled then you must additionally supply scaling operators, or use -dFitPage.
Is the PDF wrong?
No.
It seems to have been done by a scanner. Is there a way to
tell gs to get the first half of the page when using FIXEDMEDIA?
You could use the PostScript translate operator to translate the origin so that
the lower portion of the page is off the media.

I suspect using -dCropBox will be significantly easier.

I notice that you refer to 'PDFs supplied by a customer' and I would draw your
attention to the fact that Ghostscript is licenced under the AGPL, which
includes Software-as-a-service applications. You may want to check to ensure
you are complying with the terms of the licence.
--
You are receiving this mail because:
You are the QA Contact for the bug.
b***@artifex.com
2017-11-13 14:22:51 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698737

--- Comment #3 from Daniel Bautista <***@duocom.es> ---
Yes, the use of -dUseCropBox solves the problem.

Question: is it safe using -dUseCropBox with other PDFs, even if these PDFs
have no CropBox?

In other words, is something like this suitable to convert any PDF into a TIFF
A4?

gs -sDEVICE=tiffg4 -dNOPAUSE -sPAPERSIZE=a4 -dBATCH -dSAFER=true -dFIXEDMEDIA
-dUseCropBox -r200x200 -sOutputFile=file.tiff file.pdf

Thanks again!
--
You are receiving this mail because:
You are the QA Contact for the bug.
b***@artifex.com
2017-11-13 12:38:07 UTC
Permalink
http://bugs.ghostscript.com/show_bug.cgi?id=698737

--- Comment #1 from Daniel Bautista <***@duocom.es> ---
Created attachment 14455
--> http://bugs.ghostscript.com/attachment.cgi?id=14455&action=edit
The 210x432 result tiff
--
You are receiving this mail because:
You are the QA Contact for the bug.
Loading...