When I learn more linux, I feel as if I am drinking icy cold Bohemian style beer on a roof. If you know a lot of "The Shawshank Redemption", you probably know what I mean.



The  corresponding video might be found on http://www.youtube.com/watch?v=w4oPFXWXaDE

The true Bohemian style beer is http://en.wikipedia.org/wiki/Pilsner_Urquell.

Extract each page from an electronic pdf or ps file in oder to edit or modifiy them. The ps file format has much better output result than pdf file.

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=epswrite  -sOutputFile=result-%02d.eps test.ps

The related posts are
2007/08/15 - [computer/linux] - How to save each page of a pdf file to eps file
2006/12/06 - [computer/linux] - ghostscript를 사용해서 여러개 화일을 하나의 화일로 만들기 (pdf,eps, .....)



posted by citadel
To fix  the wrong bounding box information in the eps files, I use the following method
2007/05/13 - [computer/linux] - How to create a stand alone eps file by using pstricks

However, whenever I fix problems, I have to do the same procedure. It was very cumbersome procedures. I decide to make a lazy program, which do the same thing automatically. Here my second python script :

more..fixBBox.py



The  http://akaihola.blogspot.com/2007/09/goodie-for-your-pdf-toolbox-automatic.html post helps me in order to understand Popen and re. The other references are in the source code.
Note that the above script might delete or destory your eps file. Before using it, please backup your file.

2008.3.28 One guest pointed out a bug in the above script as
Thanks for this great script. But there is a small bug in the regexp. The Bbox can also contain negative numbers, in which case the compiled regular expressions won't replace the BBox string.
To fix it replace in the syntax_* variables '[\d ]+' with '[\-\d ]+'
I really appreciate this comment since this is the first and unique feedback. However, the suggestion is not enough to apply the real eps file when I realize ghostscript does not reply the correct bounding box information even if I change the regular expressions.  I found the useful note (see page 18) : http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf.

To fix these bug, I must redesign all python script. It also is a time-consuming work for me because I am not a professional programmer. Anyway, this is a sort of TODO list.

If you suffer from the negative bounding box informations, consult the adobe info booklet or try to understand the following differences. I think you will find the solution.

%%BoundingBox: -85 346 114 529
%%HiResBoundingBox: -85.509269 346.71008 113.18475 528.09641
%%EndComments
%%Page: 1 1
0 560 translate

%%BoundingBox: -85 346 114 529
%%HiResBoundingBox: -85.509269 346.71008 113.18475 528.09641
%%EndComments
%%Page: 1 1
200 560 translate
Then, You will open your eps file, translate, and save it.


posted by citadel
Sometimes, I want to extract some plot or graphical object
s from pdf file such as data sheet.  The Inkscape  can handle eps file in Linux.

With the following gs command, I can extract graphical information from pdf file.

gs -dSAFTER -dBATCH -dNOPAUSE -r300 -sDEVICE=epswrite -sOutputFile=result-%02d.eps  input.pdf

xterm output example

more..


It is the same method as old post .





'Computer > linux' 카테고리의 다른 글

ntpdate and ntp  (0) 2007.08.16
How to save each page of a pdf file to eps file  (0) 2007.08.16
새로운 세계 새로운 사람들 - 음악  (0) 2007.08.14
emacs configuration file  (0) 2007.08.10
posted by citadel