1

I have a workflow that uses one of several tools that crop a generated pdf (either the standalone class with crop=true, or the pdfcrop or dvipng tools). In some cases I want to limit the cropping on one side. Currently, I'm achieving this by doing an \hspace then writing a period. That works, but I want to know if there are more elegant solutions. I just verified that (at least with the dvipng method) writing my period in white also works (\usepackage{xcolor}...\hspace{...}\textcolor{white}.). I also verified that using \hphantom and so on does not work: the extra space generated thereby will be cropped. Any other ideas about how to achieve this---if possible, without loading the xcolor package?

1 Answer 1

1

Use pdfcrop only

You can do this with pdfcrop with no need for the \hspace and period. For example...

pdfcrop --margins 10 0 0 0 in.pdf out.pdf

will leave a margin of 10 basic points on the left side of your pdf. The order of the --margins values are left, top, right, and bottom.

You can also add a white border to an already cropped pdf.

pdfcrop --margins 10 in.pdf out.pdf

You can even use a negative margin value to "overcrop", or crop more than the white border. This is especially useful if you need to crop away a box that surrounds your content.

2
  • Thanks, yes this could be an option. In my use-case, though, I have a number of documents where the ink takes up varying space. I want them all to have a constant width. To use the --margin flag on pdfcrop, I'd have to determine a different margin width for each. So not ideal for me. But for other workflows, this might be a good option.
    – dubiousjim
    Commented Jan 4, 2018 at 12:38
  • @dubiousjim: I see. Is it possible for you to simply use the geometry package to create your original PDF already having the correct width?
    – James
    Commented Jan 4, 2018 at 12:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .