Skip to content

Commit

Permalink
Adding %%BoundingBox at the beginning of an EPS stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
sauliusg committed Mar 9, 2018
1 parent 682ac31 commit 7a2512b
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,22 @@ public String toString() {
String nl = System.getProperty("line.separator");
String split[] = result.split(nl,2);
if( split.length > 1 && split[0].startsWith("%!PS-") ) {
String boundingBox = "%%BoundingBox: ";
String boundingBox;
if( this.dim != null ) {
boundingBox += "0 0 " + dim.width + " " + dim.height + "\n";
boundingBox = "%%BoundingBox: 0 0 " +
dim.width + " " + dim.height + nl;
} else {
boundingBox = "";
}

result = split[0] + nl +
"%%BoundingBox: (atend)" + nl +
boundingBox +
split[1].
replaceFirst("(\\d+ ){4}setmargins",
"0 0 0 0 setmargins").
"0 0 0 0 setmargins").
replaceFirst("(\\d+ ){2}setpagesize",
dim.width + " " + dim.height +
" setpagesize") +
boundingBox;
dim.width + " " + dim.height +
" setpagesize");
}
}
return result;
Expand Down

0 comments on commit 7a2512b

Please sign in to comment.