Bug 690100 - Enhancement request: create centered output when reading PDF
Summary: Enhancement request: create centered output when reading PDF
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: master
Hardware: Macintosh MacOS X
: P2 enhancement
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-29 09:38 UTC by Marcos H. Woehrmann
Modified: 2011-09-18 21:46 UTC (History)
2 users (show)

See Also:
Customer: 870
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos H. Woehrmann 2008-09-29 09:38:16 UTC
The customer asks:

In the usage of  Ghostscript  the option PDFFitPage is explained as follows:
-dPDFFitPage
Rather than selecting a PageSize given by the PDF MediaBox or CropBox (see -dUseCropBox), the PDF 
file will be scaled to fit the current device page size (usually the default page size).
This is useful to avoid clipping information on a PDF document when sending to a printer that may 
have unprintable areas at the edge of the media larger than allowed for in the document.

This is also useful for creating fixed size images of PDF files that may have a variety of page sizes, for 
example thumbnail images.

          ..........

Is possible to add some more functionality, e.g. to create centered output. In the AcrobateReader it is 
possible to select  automatic rotation and centered output when printing a document.
Comment 1 Hin-Tak Leung 2009-01-19 20:56:44 UTC
pdftops (part of xpdf) also by default do shrink-to-fit and centering pages
smaller than output device size.
Comment 2 Ken Sharp 2009-01-19 23:59:49 UTC
This is actually a ps2write enhancement request, not the PDF interperter.
Re-assigning to me to deal with. 

Comment 3 SaGS 2009-02-04 02:36:02 UTC
As I understand it, it is a PDF interpreter issue, and the changed is to be 
done in pdf_main.ps::pdf_PDF2PS_matrix. Currently, the transformation computed 
there places the PDF page in the bottom-left corner of the output page’s 
imageable area (= page less hw margins). IIRC, it already rotates the page, if 
needed, to get the best fit.
Comment 4 Ken Sharp 2009-02-04 02:44:48 UTC
No, its pswrite, just like the FitPages, SetPageSize and RotatePages switches.
Doing it here means that the change will work for any input with pswrite as the
target device.

The centering is done by determining the current page size of the device, the
requested page size, and modifying the translation of the CTM so that the page
is centered.

As it happens I'm halfway through it at the moment.
Comment 5 Ken Sharp 2009-02-05 05:31:34 UTC
New feature added with revision 9450. Setting -dCenterPages will center the
output on the media. If the output is larger than the media then it will be
truncated, but still centered.

Compatible with RotatePages, but not with SetPageSize or FitPages.

Patch here:

http://ghostscript.com/pipermail/gs-cvs/2009-February/009027.html

Updated documentation in ps2ps2.htm
Comment 6 Marcos H. Woehrmann 2011-09-18 21:46:35 UTC
Changing customer bugs that have been resolved more than a year ago to closed.