From b2154ba72daa822884cc0cfec32b982a96f7fe60 Mon Sep 17 00:00:00 2001 From: arved Date: Fri, 10 Mar 2000 02:46:00 +0000 Subject: [PATCH] support for empty fonts situation git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193290 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/pdf/PDFResources.java | 63 +++++++++++++----------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/src/org/apache/fop/pdf/PDFResources.java b/src/org/apache/fop/pdf/PDFResources.java index 32e39b068..0425f2c3b 100644 --- a/src/org/apache/fop/pdf/PDFResources.java +++ b/src/org/apache/fop/pdf/PDFResources.java @@ -98,36 +98,43 @@ public class PDFResources extends PDFObject { * * @return the PDF */ - public String toPDF() { - StringBuffer p = new StringBuffer(this.number + " " - + this.generation - + " obj\n<< /Font << "); + public String toPDF() { + StringBuffer p = new StringBuffer(this.number + " " + + this.generation + + " obj\n<< \n"); + if(!this.fonts.isEmpty()) + { + p.append("/Font << "); - /* construct PDF dictionary of font object references */ - Enumeration fontEnumeration = fonts.keys(); - while (fontEnumeration.hasMoreElements()) { - String fontName = (String) fontEnumeration.nextElement(); - p = p.append("/" + fontName + " " - + ((PDFFont) fonts.get(fontName)).referencePDF() - + "\n"); - } + /* construct PDF dictionary of font object references */ + Enumeration fontEnumeration = fonts.keys(); + while (fontEnumeration.hasMoreElements()) { + String fontName = (String) fontEnumeration.nextElement(); + p = p.append("/" + fontName + " " + + ((PDFFont) fonts.get(fontName)).referencePDF() + + "\n"); + } + + p = p.append(">>\n"); + } + + p.append("/ProcSet [ /PDF /ImageC /Text ] "); - p = p.append(">>\n/ProcSet [ /PDF /ImageC /Text ] "); + if (!this.xObjects.isEmpty()) + { + p = p.append("/XObject <<"); + for (int i = 1; i < this.xObjects.size(); i++) { + p = p.append("/Im" + i + " " + + ((PDFXObject) + this.xObjects.elementAt(i - + 1)).referencePDF() + + + " \n"); + } + } - if (!this.xObjects.isEmpty()) { - p = p.append("/XObject <<"); - for (int i = 1; i < this.xObjects.size(); i++) { - p = p.append("/Im" + i + " " + - ((PDFXObject) - this.xObjects.elementAt(i - - 1)).referencePDF() - + - " \n"); - } - } + p = p.append(">>\nendobj\n"); - p = p.append(">>\nendobj\n"); - - return p.toString(); - } + return p.toString(); + } } -- 2.39.5