The easiest way to print PDF output from UNIX without installing any drivers is to convert PDF to Postscript and send directly to printer.
However, when you convert PDF to Postscript you cannot specify “shrink to fit” or “fit to printable area” option.
As a result you can get an unexpected results like:
Where is no margins
Output was moved to the lift/right/up/down
My latest problem was that one of the reports that I generated from Oracle Application , contained a logo at the top of the page. I converted PDF to Postcript (you can use xpdf or Ghostscript open source products) and sent it to the printer. Actual output on paper moved up and half of the logo was not printed
So how can you move the output without actually redesigning your report?
I will show how to do it with Ghostscript
First of all use one of the utilities I mentioned above to create a PostScript output from PDF. Assuming that output files called out.ps
Assuming that Ghostscript installed under $GS_TOP variable
1. Create new file called margin.ps. Put it under /tmp directory
The content of the file should be
/PageOffset [0 0]
/.HWMargins [0 0 0 0]
2. Run the following commands
$GS_TOP/gs/bin/gs -dSAFER -q -dNOPAUSE -dCompatibilityLevel=1.2 -dBATCH -sDEVICE=pswrite -sOutputFile=fixed.ps -dSAFER /tmp/margin.ps out.ps
That is all. Ghostscript will combine margin.ps and out.ps files and create new files called fixed.ps.
How to control the position of the output?
Note the following line in margin.ps file/PageOffset [0 0]
Left 0 controls X offset (can be also negative) and right 0 controls Y offset. Just change their values to adjust the position of the output for your needs