# Converting documents to pdf and printing



## Beeblebrox (Dec 17, 2012)

I use cups for printing and not lpd. I have setup two virtual printers in cups, virtual-pdf and virtual-ps. So far they are working fine and, if say I want to print a webpage I create the ps file first by printing the webpage to virtual-ps. I have two problems however:

1. I think that the margins on the virtual printers are a little too high, because when I print the page to paper as "2 pages per A4 paper" I get too much space between the pages, which results in the pages being shrunk too much. So I would like to minimize or zero-out the margins the virtual printers place in the ps/pdf files. I can't find any margin reference for this in /usr/local/etc/cups/cups-pdf.conf

2. I can't seem to find a good pdf crop tool (or I don't get the cli syntax). There is a script by the name of pdfcrop which calls on ghostscript and it works fine except on following conditions:
* If the page has header/footer, it does not crop beyond that
* If the pdf is made from scanned images then it crops nothing
This is of course due to the "Bounding Box" setting in the document, which many such scripts defer to. I therefore need a method for "absolute cropping" or manually specifying the points to crop from "left right top bottom".
What is the easiest method for this? What do you use (ghostcript, pdftk, poppler, podofo)?


----------



## wblock@ (Dec 18, 2012)

graphics/ImageMagick works on PDF also.  It can certainly do what you want, but I don't use it often enough to give an example command.


----------



## Beeblebrox (Dec 18, 2012)

Thanks wblock.
I'd like to solve the "cups virtual-ps printer margins" as first step. Any idea where margins can be set permanently? In command-line it's set by -o page-left=value etc, otherwise "page margins are set by the hard limits of the printer".


----------



## wblock@ (Dec 18, 2012)

The hard limits of the printer are defined in the PPD.  You could edit that to make smaller margins, but they should already be at the limits of what the printer engine can actually print, like within a few mm of the edge of the page.


----------

