I want to automatically extract figures from papers, but of course most papers come in .pdf, not .ps form... This site has a great tool for extracting figures from .ps papers: http://www-hermes.desy.de/notes/extras/postscript.html If anyone can tell me how to do the same thing for .pdfs (automatically extract figures from pdfs) I'd appreciate it. Update 12/13/08: One solution is listed at http://ubuntuforums.org/showthread.php?t=884002: use pdfimages, part of the xpdf package.
Ghostscript error?
I've been receiving the following error when attempting to compile (ps2pdf) my w5 outflows paper:
Error: /rangecheck in --get--Operand stack: pdfmark --dict:20/25(ro)(L)-- --nostringval-- 50Execution stack: %interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop 1755 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- %finish_show --nostringval-- --nostringval-- 8 6 1 --nostringval-- (pdf_text_enum_t) %op_show_continue --nostringval--Dictionary stack: --dict:1153/1684(ro)(G)-- --dict:0/20(G)-- --dict:71/200(L)-- --dict:125/300(L)-- --dict:44/200(L)-- --dict:138/224(L)--Current allocation mode is localLast OS error: 2Current file position is 267478928GPL Ghostscript 8.71: Unrecoverable error, exit code 1
I get the same error with Ghostscript 8.64, but on my laptop, using the fink version, it works. Similarly, there are errors with the postscript, so I'm led to believe it's an error in latex:
$ latex --versionpdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009)kpathsea version 5.0.0Copyright 2009 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).There is NO warranty. Redistribution of this software iscovered by the terms of both the pdfTeX copyright andthe Lesser GNU General Public License.For more information about these matters, see the filenamed COPYING and the pdfTeX source.Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).Compiled with libpng 1.2.39; using libpng 1.2.39Compiled with zlib 1.2.3; using zlib 1.2.3Compiled with xpdf version 3.02pl3
No idea what the cause is but it's time to start documenting steps and looking for a workaround. Compiling on the lappy isn't a good option.
How do I print a multi-page postscript?
I want to print a multi-page postscript duplexed and, if possible, two per page. pstopng, pstopdf, and the variants failed me horribly by making postscripts that don't fit the bounding box at all. Any ideas? So far the best I've come up with is switching gnuplot's output to pdf, which is a workaround rather than a solution, but is useful nonetheless: set terminal pdf enhanced dashed
Merging postscripts
This is essential and really difficult to find answers to, but this guy gave it: http://ludo.qix.it/archive/2005/08/merge-postscript-files.html The keywords I would have liked to see: "merge postscripts into multi-page document" or "combine postscript multiple page" e.g. gs -sDEVICE=pswrite -sOutputFile=output.ps -dNOPAUSE -dBATCH file1.ps file2.ps file3.psorgs -sDEVICE=pswrite -sOutputFile=05358spectra.ps -dNOPAUSE -dEPSFitPage -dBATCH `ls 05358_*.eps`(the added option is to make sure the .eps isn't cropped)
Postscript to PDF conversion
ls *.ps | sed 's/\(.*\).ps/ps2pdf \1.ps \1.pdf/' | bash because it's impossible to view multiple postscripts in a single window.... how annoying. Corollary: ls *.pdf | sed 's/\(.*\).pdf/pdf2jpeg \1.pdf \1.jpg/' | bash
ps2pdf keep resolution, crop to bounding box
`` ps2pdf -dEPSCrop -dAutoRotatePages=/None -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dUseFlateCompression=true l007_displaycrop.ps `` ref: this post
pstopng
Following this thread and my need to convert IDL .ps files to .pngs so that I can view them in Mac Preview without having to go through an (often failed) conversion process led to a few discoveries. First, it is challenging to get ImageMagick's convert to make an opaque background for the .ps file without seriously degrading the resolution. This can be accomplished by passing both the -alpha Off and the `` -density 300`` simultaneously. This is slow, though, and recommendations to speed it up using the -limit area 4096 -limit memory 4096 tags actually made it slower! However, the thread pointed out that ghostscript can do the conversion directly: gs -dBATCH -sDEVICE=png16m -r300 -dEPSCrop -dNOPAUSE -sOutputFile=XXX.png XXX.ps -sDEVICE sets the output to png, -r300 tag sets the density to be 300 pixels/inch, -dEPSCrop is necessary to get the right sized image out (otherwise it defaults to a portrait 8.5x11), and `` -dBATCH `` prevents the gs command line from activating after the command is executed. I'm not sure if -dNOPAUSE is necessary, but apparently if you don't activate it you have to do something after every page is processed. My code to do batch ps-to-png conversion is available at http://code.google.com/p/agpy/source/browse/trunk/agpy/pstopng. Timing demonstrations (units are seconds, R is 'real' or clock time, 'U' is user time, and 'S' is system time): /usr/local/bin/convert -density 300 -alpha Off deline_zero_10hz_timestreams_003.ps deline_zero_10hz_timestreams_003.png TIMING: R: 3.126 U: 2.948 S: 0.084/usr/local/bin/convert -limit area 4096 -limit memory 4096 -density 300 -alpha Off deline_zero_10hz_timestreams_003.ps deline_zero_10hz_timestreams_003.png TIMING: R: 3.800 U: 2.970 S: 0.161gs -dBATCH -sDEVICE=png16m -r300 -dEPSCrop -dNOPAUSE -sOutputFile=deline_zero_10hz_timestreams_003.png deline_zero_10hz_timestreams_003.psTIMING: R: 0.801 U: 0.781 S: 0.017
Page 1 / 1