On 16/12/11 09:55, ~suv wrote:
On 16/12/11 01:41, cpblpublic+usenet@...155... wrote:
> Matplotlib produces pdf figures whose bounding boxes do not enclose all of
> the contents of the figure (or, usually, are too big).
> I thought inkscape could easily solve this problem with:
> inkscape -f matplotlibOutput.pdf --verb=FitCanvasToDrawing -A prettyfigure.pdf
> But that leaves the pdf unchanged. Have I made a basic error?
$ cp matplotlibOutput.pdf prettyfigure.pdf
$ inkscape -f prettyfigure.pdf.pdf \
Note: when using verbs on the command line, the GUI cannot be suppressed
 (limits the usefulness of verbs for scripting or when trying to run
Inkscape on a web server as conversion tool): you will need to press
some buttons for commands that have options:
1 - Importing (aka opening) a PDF needs a confirmation in the import
2 - Exporting (saving as PDF) also requires a confirmation in the export
3 - The warning that you saved in a lossy format makes more sense when
working with the GUI right from the beginning. I'm not aware of a
setting to turn that warning off.
Alternative without needing to press any buttons:
$ inkscape -f matplotlibOutput.pdf -l matplotlibOutput.svg
$ inkscape -f matplotlibOutput.svg --verb=FitCanvasToDrawing \
$ inkscape -f matplotlibOutput.svg -A prettyfigure.pdf
$ rm matplotlibOutput.svg