Gentoo Archives: gentoo-user

From: meino.cramer@×××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] PDF to png/jpg/...
Date: Sun, 10 May 2009 10:49:35
Message-Id: 20090510104930.GC3486@solfire
In Reply to: Re: [gentoo-user] PDF to png/jpg/... by Florian Philipp
1 Florian Philipp <lists@f_philipp.fastmail.net> [09-05-10 12:35]:
2 > meino.cramer@×××.de schrieb:
3 > > Hi,
4 > >
5 > > does anyone know a trick/package, which allows my to
6 > > convert the pages of a pdf file to images via the commandline
7 > > (useable from a script).
8 > >
9 > > I have a/LOT/ of datasheets of electronics and want to make
10 > > something like a "pdf gallery" to find pdfs faster...
11 > >
12 > > Thanks a lot for any help in advance!
13 > > Kind regards,
14 > > Meino Cramer
15 > >
16 >
17 > You can use pdftopnm (app-text/poppler) to generate bitmap images from
18 > your pdfs. Then you can use pnmtopng (media-libs/netpbm) to create pngs
19 > from them. I suppose there are also tools for creating jpegs and such
20 > alike but I haven't looked yet.
21 >
22 > You will probably need some tweaking to get optimal results but the
23 > process should be straight forward.
24 >
25 > Make sure you have enough disk space spare. Those pnms can be quiet huge.
26 >
27
28 Thanks a lot for all tipe!
29 I will use pdftoppm now.
30 Here is a quick script written on the commandline to do this job.
31 (I use zsh.)
32
33 mkdir PDFviews
34 cd PDFviews
35 for i in ../*.pdf ../*.PDF
36 do
37 fn=${i:r}
38 fn=${fn:t}
39 fn=${fn}.png
40 pdftoppm -f 1 -l 1 $i > tmp.ppm
41 ppmtojpeg < tmp.ppm > $fn
42 done
43 rm -f tmp.ppm
44
45 Have a nice sun(ny)day !
46 Meino
47
48
49 --
50 Please don't send me any Word- or Powerpoint-Attachments
51 unless it's absolutely neccessary. - Send simply Text.
52 See http://www.gnu.org/philosophy/no-word-attachments.html
53 In a world without fences and walls nobody needs gates and windows.