[Textures] Textures 2.2.0b19 and figures in PDF

Salomon, David david.salomon at csun.edu
Wed Feb 11 16:29:40 EST 2015


This again is great help, as I have hundreds of old PDF files with important figures.

Thanks again Bruno, and don't forget to message me next time you come to San Diego. I'd love to meet you.

Best regards,

David Salomon
Computer Science Dept.  (Retired)          dsalomon at csun.edu
California State University
Northridge, CA 91330-8281
http://www.davidsalomon.name/             (619) 443-6528
USA                                                      fax (619) 749-5229
________________________________________
From: Textures <textures-bounces at email.esm.psu.edu> on behalf of Bruno Voisin <bvoisin at me.com>
Sent: Wednesday, February 11, 2015 5:23 AM
To: Textures Mailing List
Subject: Re: [Textures] Textures 2.2.0b19 and figures in PDF

> Le 11 févr. 2015 à 03:58, Salomon, David <david.salomon at csun.edu> a écrit :
>
> Success. Using Illustrator CS5 to change the bounding box to "Art" as Bruno suggested (In the Preset Parameter menu, select "fit to artwork bounds") did the trick. I can now use Textures 2.2.0b19  and include my PDF figures in the text. Many thanks to Bruno.


I forgot: in case you have many PDF files to process, a command-line utility would be more efficient. MacTeX provides one, pdfcrop, which uses Ghostscript and pdfTeX to calculate the bounding box and generate a cropped PDF file.

So assuming you have a folder "My Figures" of PDF files to process, all with extension .pdf, you could run in Terminal say

        cd "My Figures"
        apply pdfcrop *.pdf

and all the PDF files in this folder would be converted into cropped files with same name and -crop suffix.

Attached are examples of cropping with Illustrator and pdfcrop:

- Illustrator generates a file with the same size as the original file, hence it seems to just change the ArtBox without modifying the content. In particular, when cropping it takes into account the font dimensions (for the axes legends on the bottom and left sides), resulting in a bit of white space above and below the glyphs.

- pdfcrop renders the PDF file using Ghostscript, calculates the Bounding Box for this rendering, then regenerates a new PDF file from the rendering. In particular, cropping is based on the used glyphs not the font dimensions, so no white space as with AI.

There does not seem to be major differences in the output, but it's not quite the same thing. Still, for processing a large number of files pdfcrop may save some headaches.

The pdfcrop doc is at

file:///Library/TeX/Root/texmf-dist/doc/support/pdfcrop/README

and its help is reproduced below.

Bruno Voisin


$ pdfcrop --help
PDFCROP 1.38, 2012/11/02 - Copyright (c) 2002-2012 by Heiko Oberdiek.
Syntax:   pdfcrop [options] <input[.pdf]> [output file]
Function: Margins are calculated and removed for each page in the file.
Options:                                                       (defaults:)
  --help              print usage
  --version           print version number
  --(no)verbose       verbose printing                         (false)
  --(no)debug         debug informations                       (false)
  --gscmd <name>      call of ghostscript                      (gs)
  --pdftex | --xetex | --luatex
                      use pdfTeX | use XeTeX | use LuaTeX      (pdftex)
  --pdftexcmd <name>  call of pdfTeX                           (pdftex)
  --xetexcmd <name>   call of XeTeX                            (xetex)
  --luatexcmd <name>  call of LuaTeX                           (luatex)
  --margins "<left> <top> <right> <bottom>"                    (0 0 0 0)
                      add extra margins, unit is bp. If only one number is
                      given, then it is used for all margins, in the case
                      of two numbers they are also used for right and bottom.
  --(no)clip          clipping support, if margins are set     (false)
                      (not available for --xetex)
  --(no)hires         using `%%HiResBoundingBox'               (false)
                      instead of `%%BoundingBox'
  --(no)ini           use iniTeX variant of the TeX compiler   (false)
Expert options:
  --restricted        turn on restricted mode                  (false)
  --papersize <foo>   parameter for gs's -sPAPERSIZE=<foo>,
                      use only with older gs versions <7.32    ()
  --resolution <xres>x<yres>                                   ()
  --resolution <res>  pass argument to ghostscript's option -r
                      Example: --resolution 72
  --bbox "<left> <bottom> <right> <top>"                       ()
                      override bounding box found by ghostscript
                      with origin at the lower left corner
  --bbox-odd          Same as --bbox, but for odd pages only   ()
  --bbox-even         Same as --bbox, but for even pages only  ()
  --pdfversion <1.x> | auto | none
                      Set the PDF version to 1.x, 1 < x < 8.
                      If `auto' is given as value, then the
                      PDF version is taken from the header
                      of the input PDF file.
                      An empty value or `none' uses the
                      default of the TeX engine.               (auto)

Input file: If the name is `-', then the standard input is used and
  the output file name must be explicitly given.
Examples:
  pdfcrop --margins 10 input.pdf output.pdf
  pdfcrop --margins '5 10 5 20' --clip input.pdf output.pdf
In case of errors:
  Try option --verbose first to get more information.
In case of bugs:
  Please, use option --debug for bug reports.




More information about the Textures mailing list