aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2002-07-01 10:39:29 +0000
committerKeiron Liddle <keiron@apache.org>2002-07-01 10:39:29 +0000
commit7afbc7cb22f8a9922279ea5049685df4faac70eb (patch)
tree74eb0aacf3c9872391a25d48c8d91cc90e196411 /src/org/apache
parent256485c97c7117cf834050dfffaa06d15e27fb5a (diff)
downloadxmlgraphics-fop-7afbc7cb22f8a9922279ea5049685df4faac70eb.tar.gz
xmlgraphics-fop-7afbc7cb22f8a9922279ea5049685df4faac70eb.zip
fixed some minor errors
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194940 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache')
-rw-r--r--src/org/apache/fop/pdf/PDFDocument.java4
-rw-r--r--src/org/apache/fop/pdf/PDFPattern.java36
-rw-r--r--src/org/apache/fop/pdf/PDFXObject.java4
3 files changed, 20 insertions, 24 deletions
diff --git a/src/org/apache/fop/pdf/PDFDocument.java b/src/org/apache/fop/pdf/PDFDocument.java
index b1471a3b6..072411ecb 100644
--- a/src/org/apache/fop/pdf/PDFDocument.java
+++ b/src/org/apache/fop/pdf/PDFDocument.java
@@ -825,6 +825,7 @@ public class PDFDocument {
PDFFont font = new PDFFont(++this.objectcount, fontname,
PDFFont.TYPE1, basefont, encoding);
this.objects.add(font);
+ fontMap.put(basefont, font);
return font;
} else {
byte subtype = PDFFont.TYPE1;
@@ -892,6 +893,8 @@ public class PDFDocument {
makeArray(metrics.getWidths(1)));
}
+ fontMap.put(basefont, font);
+
return font;
}
}
@@ -1005,7 +1008,6 @@ public class PDFDocument {
pagewidth, pageheight);
/* add it to the list of objects */
- this.objects.add(page);
pages.addPage(page);
return page;
}
diff --git a/src/org/apache/fop/pdf/PDFPattern.java b/src/org/apache/fop/pdf/PDFPattern.java
index 432af941c..d11112f35 100644
--- a/src/org/apache/fop/pdf/PDFPattern.java
+++ b/src/org/apache/fop/pdf/PDFPattern.java
@@ -10,7 +10,7 @@ package org.apache.fop.pdf;
// Java...
import java.util.ArrayList;
import java.util.HashMap;
-import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
import java.io.IOException;
/**
@@ -191,8 +191,7 @@ public class PDFPattern extends PDFPathPaint {
*
* @return the PDF string.
*/
- public byte[] toPDF() {
-
+ protected int output(OutputStream stream) throws IOException {
int vectorSize = 0;
int tempInt = 0;
@@ -251,11 +250,7 @@ public class PDFPattern extends PDFPathPaint {
dataStream.add(this.patternDataStream.toString());
// TODO get the filters from the doc
dataStream.addDefaultFilters(new HashMap(), PDFStream.CONTENT_FILTER);
- try {
- p.append(dataStream.applyFilters());
- } catch(IOException e) {
-
- }
+ p.append(dataStream.applyFilters());
p.append("/Length " + (dataStream.getDataLength() + 1)
+ " \n");
}
@@ -292,26 +287,25 @@ public class PDFPattern extends PDFPathPaint {
p.append(">> \n");
- // stream representing the function
- if (dataStream != null) {
- try {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- baos.write(p.toString().getBytes());
- int length = dataStream.outputStreamData(baos);
+ String dict = p.toString();
+ int length = dict.length();
- baos.write(("endobj\n").getBytes());
- return baos.toByteArray();
- } catch(IOException e) {
+ stream.write(dict.getBytes());
- }
+ // stream representing the function
+ if (dataStream != null) {
+ length += dataStream.outputStreamData(stream);
}
- p.append("endobj\n");
+ String end = "endobj\n";
+ stream.write(end.getBytes());
+ length += end.length();
-
- return (p.toString().getBytes());
+ return length;
}
+ public byte[] toPDF() { return null; }
+
}
diff --git a/src/org/apache/fop/pdf/PDFXObject.java b/src/org/apache/fop/pdf/PDFXObject.java
index 8a3b9ad46..8430751d9 100644
--- a/src/org/apache/fop/pdf/PDFXObject.java
+++ b/src/org/apache/fop/pdf/PDFXObject.java
@@ -62,7 +62,7 @@ public class PDFXObject extends PDFObject {
p = p + "<</Type /XObject\n";
p = p + "/Subtype /Image\n";
p = p + "/Name /Im" + Xnum + "\n";
- p = p + "/Length " + imgStream.getDataLength() + "\n";
+ p = p + "/Length " + (imgStream.getDataLength() + 1) + "\n";
p = p + "/Width " + pdfimage.getWidth() + "\n";
p = p + "/Height " + pdfimage.getHeight() + "\n";
p = p + "/BitsPerComponent " + pdfimage.getBitsPerPixel() +
@@ -133,7 +133,7 @@ public class PDFXObject extends PDFObject {
String p = this.number + " " + this.generation + " obj\n";
p = p + "<</Type /XObject\n";
p = p + "/Subtype /PS\n";
- p = p + "/Length " + imgStream.getDataLength();
+ p = p + "/Length " + (imgStream.getDataLength() + 1);
p = p + dictEntries;
p = p + ">>\n";