From: Jeremias Maerki Date: Sat, 15 Mar 2003 16:56:03 +0000 (+0000) Subject: Improve Filter argument construction X-Git-Tag: Alt-Design-integration-base~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5e306ae0a663283ea0cffe2314244d06e01baa98;p=xmlgraphics-fop.git Improve Filter argument construction git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196102 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/pdf/PDFStream.java b/src/java/org/apache/fop/pdf/PDFStream.java index b3fbbefe9..aa92361e7 100644 --- a/src/java/org/apache/fop/pdf/PDFStream.java +++ b/src/java/org/apache/fop/pdf/PDFStream.java @@ -339,20 +339,24 @@ public class PDFStream extends PDFObject { } private String buildFilterEntries(List names) { + boolean needFilterEntry = false; StringBuffer sb = new StringBuffer(); - sb.append("/Filter "); - if (names.size() > 1) { - sb.append("[ "); - } - for (int count = 0; count < names.size(); count++) { - sb.append((String)names.get(count)); - sb.append(" "); + sb.append("/Filter [ "); + for (int i = 0; i < names.size(); i++) { + final String name = (String)names.get(i); + if (name.length() > 0) { + needFilterEntry = true; + sb.append(name); + sb.append(" "); + } } - if (names.size() > 1) { + if (needFilterEntry) { sb.append("]"); + sb.append("\n"); + return sb.toString(); + } else { + return ""; } - sb.append("\n"); - return sb.toString(); } private String buildDecodeParms(List parms) {