달력

072014  이전 다음

  •  
  •  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  •  
  •  
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

티스토리 툴바