Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

EPS: Bounding Box Problem

📅 2011-May-11 ⬩ ✍️ Ashwin Nanjappa ⬩ 📚 Archive

 

Problem

Some EPS file generators produce a BoundingBox attribute that is all zeroes. This can fail certain programs that depend on non-zero BoundingBox values in EPS files. (For an example of such a failure see here).

Solution

Here is a quick hack that might work. EPS files are text files and can be opened and edited using any text editor. Open the EPS file in a text editor and check if it has a HiResBoundingBox attribute. If it does, you are in luck! 😊 Copy over its values to the BoundingBox attribute. If this does not work, copy over the HiResBoundingBox values and convert them to integers for BoundingBox.