Summary: | "pdfwrite" output device uses default paper size instead of page size(s) of the document | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | Till Kamppeter <till.kamppeter> |
Component: | PDF Writer | Assignee: | Ken Sharp <ken.sharp> |
Status: | RESOLVED INVALID | ||
Severity: | major | ||
Priority: | P4 | ||
Version: | 8.64 | ||
Hardware: | All | ||
OS: | All | ||
URL: | https://bugs.launchpad.net/bugs/357732 | ||
Customer: | Word Size: | --- | |
Attachments: |
flphoto-small-print.ps
testpage-cups.ps testpage-a4.ps |
Description
Till Kamppeter
2009-04-16 04:02:44 UTC
Created attachment 4934 [details]
flphoto-small-print.ps
Print output of FL-Photo: A photo in 4x6 format
Ghostscript works as designed. The sample file doesn't set the page size and Ghostscript uses default page size, usually, US Letter. Distiller also uses US Letter. There's nothing to fix here. The file has the following DSC comments: %!PS-Adobe-3.0 %%BoundingBox: 0 0 288 432 %%Creator: flPhoto v1.3.1 i.e. is is not a EPS file. The BoundingBox comment in PS file indicates the marked area on the page, rather than the media size. For multi-page documents BoundingBox is defined as thee union of the page boxes, which doesn't correspond to any real box on any page. The use of BoundingBox in PS files to set the initial page size is likely to break other files. The bug report should be filed against "flPhoto v1.3.1" that relies on default page size. Created attachment 4935 [details]
testpage-cups.ps
Alex, I've been discussing the problem with Till on IRC. I agree completely
with the phot file. However the bug report from the Ubuntu user seems
different. The job apparently does contain a /PageSize, but we seem to be
ignoring it.
Possibly there is something in the job (produced initially by pswrite!) which
is obscuring the request. Setting the PageSize Policy to 2 might be the
problem.
I've attached the job from the Ubuntu report here, but haven't had a chance to
debug it yet, I'm currently running a full pdfwrite regression test, which
takes ages....
Created attachment 4936 [details]
testpage-a4.ps
Original Ubuntu test page in A4
Alex has pointed out that the output from pswrite contains : 612 792 /letter setpagesize Which sets the media to Letter, since this comes *after* the page size request (from a PPD ?) for A4, it takes precedence. Because the PostScript file is the result of multiple conversions by CUPS, somewhere along the line the job has been created for Letter media. Selecting A4 media will not alter the fact that it was originally prepared for Letter. The original file (testpage-a4.ps) does not contain any media selection requests (though it does contain comments about selecting A4 there are no requests and the job is not EPS, so the comments are ignored). As a result any conversion will use the default media size of Letter. This of course leads to all later conversions using letter media. I don't think there is a Ghostscript bug here, the bug is really in the application generating the original PostScript which does not request any media. This is the same problem as the photo uploaded by Till, no media selection requests. The bug is in the original PostScript, not Ghostscript's handling of it. It *is* possible to add DSC comment parsing handling, CUPS should either do this itself (as other DSC parsers do) or add a prologue which will convert %%BoundingBox comments into PageSize requests. Problem solved in the CUPS filters. pstopdf applies the PageSize setting from CUPS (from the filter command line and if not supplied there from the PPD file) to the Ghostscript command line now ("-dDEVICEWIDTHPOINTS =237 -dDEVICEHEIGHTPOINTS=525", numbers from *PaperDimension line in PPD). This sets a useful default for PostScript files without PageSize request, either the size the user has chosen in the printing dialog or the size set as printer default by the admin. Multiple-page-size documents are expected to have appropriate page size requests and with these they print correctly. Thank you for your help, Ken and Alex, it helped me to find the solution for the problem. |