Comment 10 for bug 263049

Revision history for this message
Till Kamppeter (till-kamppeter) wrote : Re: CUPS test page not suitable for PDF printing workflow, needs to be replaced

ion, can you modify the pstopdf filter so it propagates the job's page size, resolution, and margins into the conversion process?

At first find the settings for the options PageSize and Resolution. First via the fifth command line argument and if not specified there via the PPD's default settings. Get width and height of the page via the *PaperDimension line corresponding to the PageSize setting and the margins via the appropriate *ImageableArea line in the PPD.

Add appropriate option settings to the ps2ps and ps2pdf calls

ps2pdf -dDEVICEWIDTHPOINTS=XXX -dDEVICEHEIGHTPOINTS=YYY -rXRESxYRES ...

For the margins it is more complicated as a PostScript variable of a complex data type (array) has to be defined. This is not possible on the command line. One has to inject PostScript code, for example with a command line like this:

( echo -en '%!\n<</.HWMargins[50 50 50 50] /Margins[0 0]>>setpagedevice\n'; cat /usr/share/cups/data/testprint.ps ) | ps2pdf -dDEVICEWIDTHPOINTS=800 -dDEVICEHEIGHTPOINTS=1200 -r600 - testprint.pdf

With all this we get at least the left box of the test page right and we assure a clean conversion independent which paper size and resolution is requested for the job and whether the incoming PostScript already comes in the desired page size and defines it well and we are also prepared if the conversion process does any optimization for the final printing resolution.

ion, pitti, the test page itself still needs to be modified, as the content of the right box is wrong. Users of a PostScript printer would expect model name and serial number of their printer there. This info cannot be pulled from the printer by the pstopdf filter. So these items the test page should not show any more.