Sunday, 26 October 2014

How to automatically crop an exported pdf diagram produced by LibreOffice Draw?

A cropped pdf diagram is particularly useful when you need a diagram for a LaTex document. I have not found a neat and direct way to solve this by using Draw alone. Here is a handy method I concluded, to handle this automatically.

  1. Export the diagram as a pdf file as normal. It is unnecessary to change the size of the page.
  2. Use pdfcrop to automatically crop the exported pdf file. For example, you may use the following command:
pdfcrop original.pdf cropped.pdf

More usages are found at: http://manpages.ubuntu.com/manpages/gutsy/man1/pdfcrop.1.html

You may also add some margins. There are options available.

pdfcrop has some dependencies on tex tools and it is included in the package texlive-extra-utils. To install it on ubuntu (or its derivations), you may use the following command:
sudo apt-get install texlive-extra-utils

No comments:

Post a Comment