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.

Possible Duplicate:
How can I crop included PDF documents?

I have a drawing from a word file. I export it in a pdf format and i import to my tex file as a figure for a paper. The problem is that the pdf file has the size of a A4 paper while the drawing is only the 1/4 of the A4 and it is placed at the top of the pdf. As such there is a big blank area in my paper. How can i export this from Word in a smaller pdf file?

share|improve this question
2  
1. You can take a screen shot and use paint afterwards, 2. select only the figure, paste it in paint or inkscape and export it pdf, 3 use clip function of graphicx package with viewport option. Will these be useful? –  Harish Kumar May 10 '12 at 13:08
3  
the use of a tool pdfcrop is described in this question. there are some drawbacks -- if there is a page number on the pdf file, that will be included in the cropped area. –  barbara beeton May 10 '12 at 13:10
2  
Do any of the answers in the question that barbara linked to help you? If so, we'll probably close this as a duplicate of that better to help others. If not, it would be useful to know why not. –  Andrew Stacey May 10 '12 at 13:13
add comment

marked as duplicate by Martin Scharrer May 13 '12 at 7:58

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2 Answers

up vote 0 down vote accepted

I once done this in this way:

  1. export to pdf from word. The pdf has the size of a page.
  2. open the pdf with Inkscape, and export to eps. The eps file would have the right size.
  3. use the eps file in latex.

The eps file can be convert to pdf with the right size, or you may export the file directly to pdf from Inkscape. Remember to check "export area is drawing" when save as eps or pdf from Inkscape.

There seems to be some bug in direct copy paste from word to Inkscape, but I cannot recall. If it works, it'll be better.

share|improve this answer
    
i import the pdf to inkspace but when saved in pdf again the size is the same. Is there any way of resizing in inkscape. –  curious May 10 '12 at 13:43
    
@curious Can't you use eps file? the eps files have the right size. –  fefe May 10 '12 at 13:52
    
@curious Check "export area is drawing" when save as pdf. –  fefe May 10 '12 at 13:55
    
you can't easilly use eps files with pdflatex –  ArTourter May 10 '12 at 13:55
    
There is no reason to go over (E)PS, you can read and write PDFs with Inkscape directly. Try using the "export area drawing" option when exporting the PDF. This can even be done using the command line: inkscape --export-area-drawing --export-pdf output.pdf input.pdf. However, this changed the fonts in my test file. I would consider using pdfcrop instead. –  Martin Scharrer May 10 '12 at 13:59
show 2 more comments

Solution: You can use the same long pdf file and clip it with the following technique.

Let us say that we have this picture:

enter image description here

We set out to clip this picture. Here is the full code. Hope the code explains it all.

\documentclass{article}
\usepackage{graphicx,fullpage}
\begin{document}

\begin{figure}[htb]
\centering
\includegraphics[width=3cm]{chick}
\caption{A chick in full}
\end{figure}

\section{\texttt{trim}}
\texttt{trim=l b r t} $\rightarrow$ This option will crop the imported image by l from the left, b from the bottom, r from the right, and t from the top. Where l, b, r and t are lengths.

\texttt{clip} $\rightarrow$     For the \texttt{trim} option to work, you must set \verb|clip=true|.

\begin{figure}[htb]
\centering
\includegraphics[trim = 5mm 25mm 5mm 2mm, clip, width=3cm]{chick}
\caption{A chick not in full using \texttt{trim}}
\end{figure}

\section{\texttt{viewport}}
\texttt{viewport=lx ly ux uy} $\rightarrow$ This option will crop the imported image by a box (rectangular/square) determined by the points with co-ordinates (lx,ly) (measured from south west point) and (ux,uy) (measured from north east point). Here I used `l' for lower and `u` for upper.

\texttt{clip} $\rightarrow$     For the \texttt{viewport} option to work, you must set \verb|clip=true|.

\begin{figure}[htb]
\centering
\includegraphics[viewport = 5mm 25mm 40mm 55mm, clip, width=3cm]{chick}
\caption{A chick not in full using \texttt{viewport}}
\end{figure}

\end{document}

The output is:

enter image description here

I have used fullpage package so as to bring every thing in one page (personal preference).

share|improve this answer
1  
Note that you can get the real bounding box of an PDF image using Ghostscript, e.g.: gs -sDEVICE=bbox -dBATCH -dNOPAUSE -f input.pdf will print it in integer and high resolution using PS points (bp in TeX). Use them with viewport. This is done by pdfcrop which might actually be easier and will just increase the file size of the PDF by a few kb. –  Martin Scharrer May 10 '12 at 14:04
add comment

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