Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I converted an Excel chart to a PDF file by Save As.. PDF in Excel. It looks good, but there is a lot of whitespace/margin on top and bottom which I need to get rid of. The only way to do so seems to be by using Acrobat professional which I don't have. Is there a free way to do this? I use Windows by the way.

share|improve this question
    
See also Clipping a figure to content. –  Stefan Kottwitz May 8 '11 at 11:19
1  
I think this belongs to superuser. –  Caramdir May 9 '11 at 16:07
1  
Though if worded as “I have a pdf that I want to include in LaTeX, how can I (automatically) trim it”, I would consider the question on-topic. –  Caramdir May 9 '11 at 16:10

5 Answers 5

up vote 5 down vote accepted

You can use the commandline tool pdfcrop. For this you need perl.

share|improve this answer
    
It doesn't work for Windows. –  P.A May 8 '11 at 8:18
    
@P.A I changed the link –  Marco Daniel May 8 '11 at 8:20
    
Thanks very much! –  P.A May 8 '11 at 8:38
    
Spent 3 hours looking for this. Thanks! –  simon Sep 17 '12 at 14:30

You can get the size right in Excel before saving to PDF - see my answer on superuser, copied below for convenience:

To avoid the "crop the PDF" step mentioned in several answers (on superuser), you can put the chart on its own Worksheet with an appropriate paper size and zero margins. E.g. in Windows Excel 2007:

  1. Select chart, from pop-up menu choose Move Chart... | New Sheet
  2. On the new Chart Sheet, Page Layout | Margins | Custom Margins, and zero all
  3. Resize the chart to the desired size by dragging its bottom-right corner
  4. See the resulting size from Chart Tools | Format | Size
  5. Select a close size from Page Layout | Size, and adjust as necessary

If there is no size close enough, or you want to be exact, you'll need to create a custom page size. Unlike Word, Excel doesn't let you do that itself, but rather uses the size from the printer driver.

  1. Page Layout | Size | More Paper Sizes | Print..., select a printer whose driver lets you create custom page sizes - most normal PostScript or PDF drivers do
  2. Options... | Advanced... | Paper Size | PostScript Custom Page Size
  3. Set the size, taking care to get the units right and swap width and height (Excel prints as landscape by default)

It may be best not to have an outline around the chart in the PDF itself: you can choose Format Chart Area | Border Color | No Line.

share|improve this answer
    
Thanks, really useful! –  sarigalin Apr 12 at 19:24

You might want to consider using the new inkscape pdf import option. It even allows you to edit the picture. Be aware though that the result is not optimal for editing.

share|improve this answer

This is more of a Superuser question than a Latex question. You could also use Briss which doesn't require Perl.

share|improve this answer

For Windows install a Perl, eg from http://www.activestate.com/perl and then you can use pdfcrop <file> which creates a <file>-crop.pdf. You can rename the file or use the new one.

Alternatively use the trim option for \includegraphics together with clip it cuts of the defined border.

share|improve this answer
    
Thanks a lot, all useful. –  P.A May 8 '11 at 8:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.