I have a HP Deskjet 5150 PCL compatible printer and I need to print down a PostScript file. If I view the file with gv
, its margins are fine. When I try to print it with:
gs -dSAFER -dNOPAUSE -dBATCH -q -sDEVICE=hpdjportable -sOutputFile=/dev/usb/lp0 file.psthe left margin is shifted to the right by approximately 6 mm. As a consequence, the rightmost 6 mm of the page are cropped off. I know this flaw is barely noticeable, but I dislike it. The print is otherwise more than fair.
Any help is greatly appreciated.
Sounds like your printer has a hardware margin, an area where it simply cannot print, often due to paper handling hardware.
This can mean that the printable area of the paper is less than the size of the media, so if you try to print right to the edges then bits 'drop off'. Screen displays obviously don't suffer from this problem....
Generally PostScript consuming printers will either use a PPD which includes the printable area, or they will rescale the input slightly to fit.
Now, I suspect that the PCL output from Ghostscript is nothing more than a bitmap wrapped up with just enough PCL to make it print, which means that it will be assuming it can print right to the edges. So your solution will be to rescale the output slightly and probably shift it on the media a bit as well.
You can use any of several different command line options to select a different Media size such as DEVICEWIDTHPOINTS
and DEVICEHEIGHTPOINTS
or -g
you will also need to select -dFIXEDMEDIA
(so the PostScript can't change the media size) and -dFitPage
to make GS scale the contents to fit the new size. Finally you will need to write a little PostScript to move the output around a little:
-c "<</PageOffset [-18 0]>> setpagedevice" -f
You should put that as the last option, just before the input filename. You will almost certainly need to meddle with the numbers in there to make it come out right.