aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-08-22 15:14:43 +0000
committerJeremias Maerki <jeremias@apache.org>2005-08-22 15:14:43 +0000
commitde8d88e2a43539da52998032a49f58b83be44e67 (patch)
tree2d2ed68e4230a36fb74a6168ed644e56383bbecc
parente1b540f10ba6efa045dcc3be164a71bbc19d7391 (diff)
downloadxmlgraphics-fop-de8d88e2a43539da52998032a49f58b83be44e67.tar.gz
xmlgraphics-fop-de8d88e2a43539da52998032a49f58b83be44e67.zip
Fix the DSC comment (Begin|EndDocument) for EPS files. It wasn't in the right place.
Added a FOP-specific comment around the whole EPS to delimit the EPS code. Use the original URI if the EPS file has no name (which isn't parsed at the moment anyway). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@234504 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/render/ps/PSImageUtils.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/render/ps/PSImageUtils.java b/src/java/org/apache/fop/render/ps/PSImageUtils.java
index b4c3d5f43..812ed9ab8 100644
--- a/src/java/org/apache/fop/render/ps/PSImageUtils.java
+++ b/src/java/org/apache/fop/render/ps/PSImageUtils.java
@@ -162,7 +162,11 @@ public class PSImageUtils {
int[] bbox = img.getBBox();
int bboxw = bbox[2] - bbox[0];
int bboxh = bbox[3] - bbox[1];
- renderEPS(img.getEPSImage(), img.getDocName(),
+ String name = img.getDocName();
+ if (name == null || name.length() == 0) {
+ name = img.getOriginalURI();
+ }
+ renderEPS(img.getEPSImage(), name,
x, y, w, h,
bbox[0], bbox[1], bboxw, bboxh, gen);
@@ -184,14 +188,15 @@ public class PSImageUtils {
* @param bboxy y-coordinate of EPS bounding box in points
* @param bboxw width of EPS bounding box in points
* @param bboxh height of EPS bounding box in points
+ * @param gen the PS generator
* @throws IOException in case an I/O error happens during output
*/
public static void renderEPS(byte[] rawEPS, String name,
float x, float y, float w, float h,
int bboxx, int bboxy, int bboxw, int bboxh,
PSGenerator gen) throws IOException {
+ gen.writeln("%FOPBeginEPS: " + name);
gen.writeln("BeginEPSF");
- gen.writeln("%%BeginDocument: " + name);
gen.writeln(gen.formatDouble(x) + " " + gen.formatDouble(y) + " translate");
gen.writeln("0 " + gen.formatDouble(h) + " translate");
@@ -207,10 +212,11 @@ public class PSImageUtils {
gen.writeln(gen.formatDouble(bboxy) + " " + gen.formatDouble(bboxy)
+ " " + gen.formatDouble(bboxw) + " " + gen.formatDouble(bboxh) + " re clip");
gen.writeln("newpath");
+ gen.writeln("%%BeginDocument: " + name);
gen.writeByteArr(rawEPS);
gen.writeln("%%EndDocument");
gen.writeln("EndEPSF");
- gen.writeln("");
+ gen.writeln("%FOPEndEPS");
}
}