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 need to include some graphs from a datasheet in my document, but of course I don't have the source files. What would be the best course of action? It's mostly logarithmic scale graphs.

share|improve this question
5  
Hi, it would help if you could minimise the work people have to do if they want to help you. For example, we don't know what kind of datasheets you're using, what OS you're using, what kind of output you're looking for (ps, pdf, ...), and so on. –  Marc van Dongen Jan 10 '12 at 15:09

5 Answers 5

up vote 4 down vote accepted

Alternatively you could extract the data from the graph and then recreate it in your own style. There are several programs available that digitize graphs (e.g. http://digitizer.sourceforge.net/) and in the end this is often the much nicer than a copy&paste and also avoids copyright issues.

share|improve this answer
    
Yes. This enables you to apply a consistent style across all the data you ripped off from different sources. I prefer another digitizing program (see `plotdigitizer.sourceforge.net); the one mentioned above gave me some random crashes. –  Michael Palmer Jan 10 '12 at 22:20

I will assume that you are using OS X with TeXShop and that your original file is in pdf format.

A manual solution that works if there aren't too many images to copy is as follows.

TeXShop's pdf viewer allows you to copy part of a page or image. It works even for pdf files that don't come from a tex file. All you have to do is select the region you want copied with the rectangle selection tool and drag the image to your desktop (or other folder). In TeXShop's preference pane you can select the format of the copied image (pdf, png, etc.)

Maybe other pdf viewers behave like this but since I don't use them I don't know.

share|improve this answer

I use Adobe Acrobat to select regions and save images to .bmp. Then I convert them to .eps with a sam2p utility, using .bat file for batch processing.

sam2p project on google code

.bat file code:

REM Created by M.M.J. Jorritsma. 2011-09-21, Enschede, The Netherlands
@SET /P INPUT=[Type the extension of the images to be batch-converted. example: jpg]
@SET /P OUTPUT=[Type the extension of the target image format. example: eps]
@ECHO Now converting from "%INPUT%" to "%OUTPUT%".
@SET /P CONTINUE=[Continue? [Y/N]]
@if /I %CONTINUE%==Y (
    @for /R %%i In (*.%INPUT%) DO @(
    @cls
    @echo sam2p %%~ni.%INPUT% %%~ni.%OUTPUT%
    sam2p %%~ni.%INPUT% %%~ni.%OUTPUT%
    )
)
share|improve this answer
2  
This is potentially messy. If the image you're copying, which is likely to be a vector graphic if it is a plot, is saved to bitmap before putting it into an eps container then the resultant eps is not a vector graphic. This typically results in low quality images (looks bad) or large files (pdf readers may get choppy when you scroll and the document that it is put in will be large). In short, one should avoid turning a vector graphic into a raster graphic if it is to be placed in another vector graphic later. –  qubyte Jan 10 '12 at 15:54
    
Thanks for comment, @MarkS.Everitt! Haven't thought about it. In my case there were raster images. –  labramov Jan 10 '12 at 16:41

use

\includegraphics[page=...,viewport=llx lly urx ury,clip]{pdf-file}

or run

pdfimages [options] <PDF-file> <image-root>

the first one simply inserts the page=<no> of your pdf and clips everything around the viewport. The second one is a Linux command, which extracts all images from a pdf file, eg

pdfimages -f1 -l4 <PDF-file> .

extracts the images of pages 1--4 into the current directory

share|improve this answer
    
+1: probably worth mentioning that \includegraphics is from the graphicx package –  cmhughes Jan 10 '12 at 17:20
1  
no, \includegraphics is from graphics, only the optional arguments need graphicx ... ;-) –  Herbert Jan 10 '12 at 17:42
1  
Note that pdfimages will extract only bitmap graphics. If the graphic is a line drawing, such as a cartoon or plot, pdfimages will not find it. Also note that by default pdfimages writes ppm files. You can give it a -j option to make it save jpeg files instead. –  Michael Palmer Jan 10 '12 at 22:17
    
@MichaelPalmer, Is there any way to extract line drawings from a pdf file? –  Hongying Jun 3 '13 at 12:19

Alternatively, it is possible to use a PDF printer in order to print a current view in a PDF file and use a paper format that corresponds to the dimensions. In this way, vector graphics are preserved. This is kind of a dirty trick, but it works for me...

share|improve this answer

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.