diff options
Diffstat (limited to 'src/org/apache')
-rw-r--r-- | src/org/apache/fop/pdf/PDFDocument.java | 4 | ||||
-rw-r--r-- | src/org/apache/fop/pdf/PDFPattern.java | 36 | ||||
-rw-r--r-- | src/org/apache/fop/pdf/PDFXObject.java | 4 |
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"; |