You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ge...@locus.apache.org on 2000/10/13 00:11:33 UTC
cvs commit: xml-fop/src/org/apache/fop/pdf PDFBinaryStream.java
gears 00/10/12 15:11:33
Modified: . build.xml
docs/examples/fo images.fo
lib Compare.java
src/codegen properties.xml
src/org/apache/fop/fo/pagination PageSequenceMaster.java
RepeatablePageMasterAlternatives.java
src/org/apache/fop/pdf PDFBinaryStream.java
Log:
Christian Geisert's patch to allow JDK 1.1 people to use no images.
Doesn't hurt on 1.2, but haven't tested on 1.1 system.
Revision Changes Path
1.7 +28 -0 xml-fop/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-fop/build.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- build.xml 2000/10/05 17:58:54 1.6
+++ build.xml 2000/10/12 22:11:31 1.7
@@ -155,6 +155,14 @@
<property name="ignore_this" value="ignore_this.java"/>
<property name="jimi" value="JimiImage.java"/>
+ <property name="ignore_jdk11"
+ value="org/apache/fop/render/awt/**
+ ,org/apache/fop/image/analyzer/*
+ ,org/apache/fop/viewer/**
+ ,org/apache/fop/image/*
+ ,**/PrintCommandLine.java
+ ,**/AWTCommandLine.java"/>
+
<property name="xslt" value="org.apache.xalan.xslt.Process"/>
<property name="src.properties.xsl" value="${src.codegen}/properties.xsl"/>
<property name="properties.xml" value="${build.codegen}/properties.xml"/>
@@ -317,12 +325,32 @@
excludes="**/${ignore_this},${jimi}"/>
</target>
+ <target name="compile-jdk11" depends="codegen, prepare-src">
+ <echo message="Compiling the sources for JDK1.1"/>
+ <!-- create directories -->
+ <mkdir dir="${build.dest}"/>
+
+ <javac srcdir="${build.src}"
+ destdir="${build.dest}"
+ debug="${debug}"
+ deprecation="${deprecation}"
+ optimize="${optimize}"
+ excludes="**/${ignore_this},${jimi},${ignore_jdk11}"/>
+ </target>
+
<!-- =================================================================== -->
<!-- Creates the class package -->
<!-- =================================================================== -->
<target name="package" depends="compile">
<echo message="Creating the jar file ${build.dir}/${name}.jar"/>
<jar jarfile="${build.dir}/${name}.jar"
+ basedir="${build.dest}"
+ includes="org/**"/>
+ </target>
+
+ <target name="package-jdk11" depends="compile-jdk11">
+ <echo message="Creating the jar file ${build.dir}/${name}11.jar"/>
+ <jar jarfile="${build.dir}/${name}-jdk11.jar"
basedir="${build.dest}"
includes="org/**"/>
</target>
1.10 +1 -1 xml-fop/docs/examples/fo/images.fo
Index: images.fo
===================================================================
RCS file: /home/cvs/xml-fop/docs/examples/fo/images.fo,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- images.fo 2000/09/25 10:37:43 1.9
+++ images.fo 2000/10/12 22:11:31 1.10
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<fo:root font-family="Times Roman" font-size="12pt" text-align="justify" xmlns:fo="http://www.w3.org/1999/XSL/Format">
+<fo:root font-family="Times Roman" font-size="12pt" text-align="center" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="right"
1.3 +1 -1 xml-fop/lib/Compare.java
Index: Compare.java
===================================================================
RCS file: /home/cvs/xml-fop/lib/Compare.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Compare.java 2000/07/06 18:03:50 1.2
+++ Compare.java 2000/10/12 22:11:31 1.3
@@ -92,7 +92,7 @@
StringTokenizer tokens = new StringTokenizer(filenames,",");
Vector filenameListTmp = new Vector(20);
while (tokens.hasMoreTokens()) {
- filenameListTmp.add(tokens.nextToken());
+ filenameListTmp.addElement(tokens.nextToken());
}
filenameList = new String [filenameListTmp.size()] ;
filenameListTmp.copyInto((String[]) filenameList);
1.24 +2 -2 xml-fop/src/codegen/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/xml-fop/src/codegen/properties.xml,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- properties.xml 2000/10/12 19:58:33 1.23
+++ properties.xml 2000/10/12 22:11:32 1.24
@@ -195,10 +195,10 @@
<inherited>true</inherited>
<datatype>
<enumeration>
- <value const="START">start</value>
+ <value const="CENTER">center</value>
<value const="END">end</value>
+ <value const="START">start</value>
<value const="JUSTIFY">justify</value>
- <value const="CENTER">center</value>
</enumeration>
</datatype>
<default>start</default>
1.2 +4 -3 xml-fop/src/org/apache/fop/fo/pagination/PageSequenceMaster.java
Index: PageSequenceMaster.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequenceMaster.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PageSequenceMaster.java 2000/07/11 02:48:59 1.1
+++ PageSequenceMaster.java 2000/10/12 22:11:32 1.2
@@ -1,4 +1,4 @@
-/*-- $Id: PageSequenceMaster.java,v 1.1 2000/07/11 02:48:59 arved Exp $ --
+/*-- $Id: PageSequenceMaster.java,v 1.2 2000/10/12 22:11:32 gears Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -109,12 +109,13 @@
protected void addSubsequenceSpecifier( SubSequenceSpecifier pageMasterReference )
{
- subSequenceSpecifiers.add( pageMasterReference );
+ subSequenceSpecifiers.addElement( pageMasterReference );
}
protected SubSequenceSpecifier getNextSubsequenceSpecifier()
{
- currentPmr = (SubSequenceSpecifier)subSequenceSpecifiers.remove( 0 );
+ currentPmr = (SubSequenceSpecifier)subSequenceSpecifiers.elementAt( 0 );
+ subSequenceSpecifiers.removeElementAt(0);
return currentPmr;
}
1.3 +2 -2 xml-fop/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java
Index: RepeatablePageMasterAlternatives.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RepeatablePageMasterAlternatives.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RepeatablePageMasterAlternatives.java 2000/08/13 17:15:59 1.2
+++ RepeatablePageMasterAlternatives.java 2000/10/12 22:11:32 1.3
@@ -1,4 +1,4 @@
-/*-- $Id: RepeatablePageMasterAlternatives.java,v 1.2 2000/08/13 17:15:59 arved Exp $ --
+/*-- $Id: RepeatablePageMasterAlternatives.java,v 1.3 2000/10/12 22:11:32 gears Exp $ --
============================================================================
The Apache Software License, Version 1.1
@@ -129,7 +129,7 @@
for (int i = 0; i < conditionalPageMasterRefs.size(); i++)
{
ConditionalPageMasterReference cpmr =
- (ConditionalPageMasterReference)conditionalPageMasterRefs.get(i);
+ (ConditionalPageMasterReference)conditionalPageMasterRefs.elementAt(i);
// 0-indexed page number
if (cpmr.isValid(currentPageNumber + 1, thisIsFirstPage))
1.2 +214 -214 xml-fop/src/org/apache/fop/pdf/PDFBinaryStream.java
Index: PDFBinaryStream.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFBinaryStream.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PDFBinaryStream.java 2000/05/23 09:20:08 1.1
+++ PDFBinaryStream.java 2000/10/12 22:11:33 1.2
@@ -1,214 +1,214 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jt...@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
- */
-
-//Author: Eric SCHAEFFER
-//Description: Encode a binary stream using PDF filters
-
-package org.apache.fop.pdf;
-
-import org.apache.fop.datatypes.ColorSpace;
-
-// Java
-import java.util.Vector;
-import java.lang.reflect.Array;
-
-import java.io.*;
-
-// compression
-import java.util.zip.Deflater;
-
-public class PDFBinaryStream {
-
- private byte[] m_data = null;
- private int m_dataSize = 0;
- private Vector m_filters = null;
-
- public PDFBinaryStream() {
- m_filters = new Vector();
- }
-
- public void setData(byte[] data) {
- this.m_data = data;
- this.m_dataSize = java.lang.reflect.Array.getLength(this.m_data);
- }
-
- public void encode(PDFFilter filter) throws PDFFilterException {
- if (this.m_data == null) throw new PDFFilterException("no data to encode");
-
- int filterType = filter.getType();
- if (filterType == PDFFilter.FLATE_DECODE) {
- Deflater compressor = new Deflater();
-
- // PDFFilter properties ?
- compressor.setLevel(Deflater.DEFAULT_COMPRESSION);
- compressor.setStrategy(Deflater.DEFAULT_STRATEGY);
-
- compressor.setInput(m_data);
- compressor.finish();
- byte[] compMap = new byte[this.m_dataSize];
- int compSize = compressor.deflate(compMap);
- compressor.end();
-
- this.m_data = new byte[compSize];
- for (int i = 0; i < compSize; i++) {
- this.m_data[i] = compMap[i];
- }
- this.m_dataSize = compSize;
-// this.m_data = compMap;
-// this.m_dataSize = java.lang.reflect.Array.getLength(this.m_data);
-// } else if (filterType == PDFFilter.LZW_DECODE) {
- } else if (filterType == PDFFilter.ASCII_HEX_DECODE) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < this.m_dataSize; i++) {
- int val = (int) (this.m_data[i] & 0xFF);
- if (val < 16) buffer.append("0");
- buffer.append(Integer.toHexString(val));
-//// TEST ////
-/*
-buffer.append(" ");
-if (i % 75 == 0) buffer.append("\n");
-*/
-//// TEST ////
- }
- this.m_data = buffer.toString().getBytes();
- this.m_dataSize = java.lang.reflect.Array.getLength(this.m_data);
- } else {
- throw new PDFFilterException("filter not supported");
- }
-
- this.m_filters.add(filter);
- }
-
- public String toPDF() {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("<<\n/Length ");
- buffer.append(this.m_dataSize);
- buffer.append("\n");
- buffer.append("/Filter [");
- for (int i = this.m_filters.size(); i > 0; i--) {
- PDFFilter filter = (PDFFilter) this.m_filters.get(i - 1);
- buffer.append(filter.toPDF());
- if (i > 1) buffer.append(" ");
- }
- buffer.append("]\n");
- buffer.append(">>\n");
-
- buffer.append("stream\n");
- buffer.append(this.m_data);
- buffer.append("\nendstream\n");
-
- return buffer.toString();
- }
-
- public String getPDFDictionary() {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("/Length ");
-//// TEST ////
- buffer.append(this.m_dataSize);
-// buffer.append(this.m_dataSize + 1);
-//// TEST ////
- buffer.append("\n");
- if (this.m_filters.size() > 0) {
- buffer.append("/Filter [");
- for (int i = this.m_filters.size(); i > 0; i--) {
- PDFFilter filter = (PDFFilter) this.m_filters.get(i - 1);
- buffer.append(filter.toPDF());
- if (i > 1) buffer.append(" ");
- }
- buffer.append("]\n");
- }
-
- return buffer.toString();
- }
-
- public String getPDFStream() {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("stream\n");
- buffer.append(this.m_data);
-//// TEST ////
-// buffer.append(">");
-//// TEST ////
- buffer.append("\nendstream\n");
-
- return buffer.toString();
- }
-
- public int outputPDFStream(PrintWriter writer) throws IOException {
- int length = 0;
- String p;
-
- p = new String("stream\n");
- writer.write(p);
- length += p.length();
-
-/*
- for (int i = 0; i < this.m_dataSize; i++) {
- writer.write(Byte.toString(this.m_data[i]));
- }
-*/
- writer.write(new String(this.m_data));
- length += this.m_dataSize;
-//// TEST ////
-// writer.write(">");
-// length += (new String(">")).length();
-//// TEST ////
-
- p = new String("\nendstream\n");
- writer.write(p);
- length += p.length();
-
- return length;
- }
-
-}
+/*
+
+ ============================================================================
+ The Apache Software License, Version 1.1
+ ============================================================================
+
+ Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modifica-
+ tion, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. The end-user documentation included with the redistribution, if any, must
+ include the following acknowledgment: "This product includes software
+ developed by the Apache Software Foundation (http://www.apache.org/)."
+ Alternately, this acknowledgment may appear in the software itself, if
+ and wherever such third-party acknowledgments normally appear.
+
+ 4. The names "Fop" and "Apache Software Foundation" must not be used to
+ endorse or promote products derived from this software without prior
+ written permission. For written permission, please contact
+ apache@apache.org.
+
+ 5. Products derived from this software may not be called "Apache", nor may
+ "Apache" appear in their name, without prior written permission of the
+ Apache Software Foundation.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ This software consists of voluntary contributions made by many individuals
+ on behalf of the Apache Software Foundation and was originally created by
+ James Tauber <jt...@jtauber.com>. For more information on the Apache
+ Software Foundation, please see <http://www.apache.org/>.
+
+ */
+
+//Author: Eric SCHAEFFER
+//Description: Encode a binary stream using PDF filters
+
+package org.apache.fop.pdf;
+
+import org.apache.fop.datatypes.ColorSpace;
+
+// Java
+import java.util.Vector;
+import java.lang.reflect.Array;
+
+import java.io.*;
+
+// compression
+import java.util.zip.Deflater;
+
+public class PDFBinaryStream {
+
+ private byte[] m_data = null;
+ private int m_dataSize = 0;
+ private Vector m_filters = null;
+
+ public PDFBinaryStream() {
+ m_filters = new Vector();
+ }
+
+ public void setData(byte[] data) {
+ this.m_data = data;
+ this.m_dataSize = java.lang.reflect.Array.getLength(this.m_data);
+ }
+
+ public void encode(PDFFilter filter) throws PDFFilterException {
+ if (this.m_data == null) throw new PDFFilterException("no data to encode");
+
+ int filterType = filter.getType();
+ if (filterType == PDFFilter.FLATE_DECODE) {
+ Deflater compressor = new Deflater();
+
+ // PDFFilter properties ?
+ compressor.setLevel(Deflater.DEFAULT_COMPRESSION);
+ compressor.setStrategy(Deflater.DEFAULT_STRATEGY);
+
+ compressor.setInput(m_data);
+ compressor.finish();
+ byte[] compMap = new byte[this.m_dataSize];
+ int compSize = compressor.deflate(compMap);
+ compressor.end();
+
+ this.m_data = new byte[compSize];
+ for (int i = 0; i < compSize; i++) {
+ this.m_data[i] = compMap[i];
+ }
+ this.m_dataSize = compSize;
+// this.m_data = compMap;
+// this.m_dataSize = java.lang.reflect.Array.getLength(this.m_data);
+// } else if (filterType == PDFFilter.LZW_DECODE) {
+ } else if (filterType == PDFFilter.ASCII_HEX_DECODE) {
+ StringBuffer buffer = new StringBuffer();
+ for (int i = 0; i < this.m_dataSize; i++) {
+ int val = (int) (this.m_data[i] & 0xFF);
+ if (val < 16) buffer.append("0");
+ buffer.append(Integer.toHexString(val));
+//// TEST ////
+/*
+buffer.append(" ");
+if (i % 75 == 0) buffer.append("\n");
+*/
+//// TEST ////
+ }
+ this.m_data = buffer.toString().getBytes();
+ this.m_dataSize = java.lang.reflect.Array.getLength(this.m_data);
+ } else {
+ throw new PDFFilterException("filter not supported");
+ }
+
+ this.m_filters.addElement(filter);
+ }
+
+ public String toPDF() {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("<<\n/Length ");
+ buffer.append(this.m_dataSize);
+ buffer.append("\n");
+ buffer.append("/Filter [");
+ for (int i = this.m_filters.size(); i > 0; i--) {
+ PDFFilter filter = (PDFFilter) this.m_filters.elementAt(i - 1);
+ buffer.append(filter.toPDF());
+ if (i > 1) buffer.append(" ");
+ }
+ buffer.append("]\n");
+ buffer.append(">>\n");
+
+ buffer.append("stream\n");
+ buffer.append(this.m_data);
+ buffer.append("\nendstream\n");
+
+ return buffer.toString();
+ }
+
+ public String getPDFDictionary() {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("/Length ");
+//// TEST ////
+ buffer.append(this.m_dataSize);
+// buffer.append(this.m_dataSize + 1);
+//// TEST ////
+ buffer.append("\n");
+ if (this.m_filters.size() > 0) {
+ buffer.append("/Filter [");
+ for (int i = this.m_filters.size(); i > 0; i--) {
+ PDFFilter filter = (PDFFilter) this.m_filters.elementAt(i - 1);
+ buffer.append(filter.toPDF());
+ if (i > 1) buffer.append(" ");
+ }
+ buffer.append("]\n");
+ }
+
+ return buffer.toString();
+ }
+
+ public String getPDFStream() {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("stream\n");
+ buffer.append(this.m_data);
+//// TEST ////
+// buffer.append(">");
+//// TEST ////
+ buffer.append("\nendstream\n");
+
+ return buffer.toString();
+ }
+
+ public int outputPDFStream(PrintWriter writer) throws IOException {
+ int length = 0;
+ String p;
+
+ p = new String("stream\n");
+ writer.write(p);
+ length += p.length();
+
+/*
+ for (int i = 0; i < this.m_dataSize; i++) {
+ writer.write(Byte.toString(this.m_data[i]));
+ }
+*/
+ writer.write(new String(this.m_data));
+ length += this.m_dataSize;
+//// TEST ////
+// writer.write(">");
+// length += (new String(">")).length();
+//// TEST ////
+
+ p = new String("\nendstream\n");
+ writer.write(p);
+ length += p.length();
+
+ return length;
+ }
+
+}