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 ch...@apache.org on 2002/05/31 02:17:17 UTC

cvs commit: xml-fop/src/org/apache/fop/pdf ASCII85Filter.java ASCIIHexFilter.java PDFAnnotList.java PDFArray.java PDFCIDFont.java PDFCIDSystemInfo.java PDFDocument.java PDFEncoding.java PDFFileSpec.java PDFFont.java PDFFontDescriptor.java PDFFunction.java PDFGoTo.java PDFGoToRemote.java PDFICCStream.java PDFInfo.java PDFLink.java PDFOutline.java PDFPage.java PDFPages.java PDFPattern.java PDFRectangle.java PDFResources.java PDFRoot.java PDFShading.java PDFStream.java PDFT1Stream.java PDFTTFStream.java PDFWArray.java PDFXObject.java

chrisg      02/05/30 17:17:17

  Modified:    .        Tag: fop-0_20_2-maintain CHANGES
               src/org/apache/fop/pdf Tag: fop-0_20_2-maintain
                        ASCII85Filter.java ASCIIHexFilter.java
                        PDFAnnotList.java PDFArray.java PDFCIDFont.java
                        PDFCIDSystemInfo.java PDFDocument.java
                        PDFEncoding.java PDFFileSpec.java PDFFont.java
                        PDFFontDescriptor.java PDFFunction.java
                        PDFGoTo.java PDFGoToRemote.java PDFICCStream.java
                        PDFInfo.java PDFLink.java PDFOutline.java
                        PDFPage.java PDFPages.java PDFPattern.java
                        PDFRectangle.java PDFResources.java PDFRoot.java
                        PDFShading.java PDFStream.java PDFT1Stream.java
                        PDFTTFStream.java PDFWArray.java PDFXObject.java
  Log:
  Fixed PDF-Renderer to work on EBCDIC systems
  (Actually on systems where file.encoding != ASCII/ISO-8859)
   Submitted by: Jason West <Ja...@mail.state.ky.us>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.10.2.16 +4 -0      xml-fop/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/xml-fop/CHANGES,v
  retrieving revision 1.10.2.15
  retrieving revision 1.10.2.16
  diff -u -r1.10.2.15 -r1.10.2.16
  --- CHANGES	8 May 2002 15:18:48 -0000	1.10.2.15
  +++ CHANGES	31 May 2002 00:17:16 -0000	1.10.2.16
  @@ -18,6 +18,10 @@
     Submitted by: Michal Buchtik <Bu...@dlsystem.cz>
   - Added support for background-image
     Submitted by: Michael Gratton <mj...@recalldesign.com>
  +- Fixed PDF-Renderer to work on EBCDIC systems 
  +  (Actually on systems where file.encoding != ASCII/ISO-8859)
  +  Submitted by: Jason West <Ja...@mail.state.ky.us>
  +  
   ==============================================================================
   Done since 0.20.2 release
   *** General
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.1   +9 -6      xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java
  
  Index: ASCII85Filter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/ASCII85Filter.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- ASCII85Filter.java	30 Jul 2001 20:29:29 -0000	1.3
  +++ ASCII85Filter.java	31 May 2002 00:17:16 -0000	1.3.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: ASCII85Filter.java,v 1.3 2001/07/30 20:29:29 tore Exp $
  + * $Id: ASCII85Filter.java,v 1.3.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -9,6 +9,7 @@
   
   import java.io.ByteArrayOutputStream;
   import java.io.IOException;
  +import java.io.UnsupportedEncodingException;
   
   public class ASCII85Filter extends PDFFilter {
       private static final char ASCII85_ZERO = 'z';
  @@ -87,12 +88,14 @@
   
           }
           // finally write the two character end of data marker
  -        buffer.write(ASCII85_EOD.getBytes(), 0,
  -                     ASCII85_EOD.getBytes().length);
  -
  -
  +        byte[] eod;
  +        try {
  +            eod = ASCII85_EOD.getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            eod = ASCII85_EOD.getBytes();
  +        }       
  +        buffer.write(eod, 0, eod.length);
           byte[] result = buffer.toByteArray();
  -
   
           // assert that we have the correct outgoing length
           /*
  
  
  
  1.2.2.1   +7 -3      xml-fop/src/org/apache/fop/pdf/ASCIIHexFilter.java
  
  Index: ASCIIHexFilter.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/ASCIIHexFilter.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ASCIIHexFilter.java	30 Jul 2001 20:29:29 -0000	1.2
  +++ ASCIIHexFilter.java	31 May 2002 00:17:16 -0000	1.2.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: ASCIIHexFilter.java,v 1.2 2001/07/30 20:29:29 tore Exp $
  + * $Id: ASCIIHexFilter.java,v 1.2.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -8,6 +8,7 @@
   
   import java.io.ByteArrayOutputStream;
   import java.io.IOException;
  +import java.io.UnsupportedEncodingException;
   
   public class ASCIIHexFilter extends PDFFilter {
       private static final String ASCIIHEX_EOD = ">";
  @@ -32,8 +33,11 @@
           }
           buffer.append(ASCIIHEX_EOD);
   
  -        return buffer.toString().getBytes();
  -
  +        try {
  +            return buffer.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return buffer.toString().getBytes();
  +        }       
       }
   
   }
  
  
  
  1.3.2.1   +8 -2      xml-fop/src/org/apache/fop/pdf/PDFAnnotList.java
  
  Index: PDFAnnotList.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFAnnotList.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- PDFAnnotList.java	30 Jul 2001 20:29:29 -0000	1.3
  +++ PDFAnnotList.java	31 May 2002 00:17:16 -0000	1.3.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFAnnotList.java,v 1.3 2001/07/30 20:29:29 tore Exp $
  + * $Id: PDFAnnotList.java,v 1.3.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -8,6 +8,7 @@
   package org.apache.fop.pdf;
   
   // Java
  +import java.io.UnsupportedEncodingException;
   import java.util.Vector;
   
   /**
  @@ -71,7 +72,12 @@
                            + "\n");
           }
           p = p.append("]\nendobj\n");
  -        return p.toString().getBytes();
  +
  +        try {
  +            return p.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.toString().getBytes();
  +        }       
       }
   
       /*
  
  
  
  1.3.2.1   +10 -2     xml-fop/src/org/apache/fop/pdf/PDFArray.java
  
  Index: PDFArray.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFArray.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- PDFArray.java	30 Jul 2001 20:29:29 -0000	1.3
  +++ PDFArray.java	31 May 2002 00:17:16 -0000	1.3.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFArray.java,v 1.3 2001/07/30 20:29:29 tore Exp $
  + * $Id: PDFArray.java,v 1.3.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,9 @@
   
   package org.apache.fop.pdf;
   
  +//Java
  +import java.io.UnsupportedEncodingException;
  +
   /**
    * class representing an array object
    */
  @@ -42,7 +45,12 @@
               p.append(values[i]);
           }
           p.append("]\nendobj\n");
  -        return p.toString().getBytes();
  +        
  +        try {
  +            return p.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.toString().getBytes();
  +        }       
       }
   
   }
  
  
  
  1.3.2.1   +9 -2      xml-fop/src/org/apache/fop/pdf/PDFCIDFont.java
  
  Index: PDFCIDFont.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFCIDFont.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- PDFCIDFont.java	30 Jul 2001 20:29:29 -0000	1.3
  +++ PDFCIDFont.java	31 May 2002 00:17:16 -0000	1.3.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFCIDFont.java,v 1.3 2001/07/30 20:29:29 tore Exp $
  + * $Id: PDFCIDFont.java,v 1.3.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,9 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
  +
   // based on work by Takayuki Takeuchi
   
   /**
  @@ -147,7 +150,11 @@
        * @return the PDF
        */
       public byte[] toPDF() {
  -        return toPDFString().getBytes();
  +        try {
  +            return toPDFString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return toPDFString().getBytes();
  +        }       
       }
   
       public String toPDFString() {
  
  
  
  1.2.2.1   +9 -2      xml-fop/src/org/apache/fop/pdf/PDFCIDSystemInfo.java
  
  Index: PDFCIDSystemInfo.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFCIDSystemInfo.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- PDFCIDSystemInfo.java	30 Jul 2001 20:29:29 -0000	1.2
  +++ PDFCIDSystemInfo.java	31 May 2002 00:17:16 -0000	1.2.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFCIDSystemInfo.java,v 1.2 2001/07/30 20:29:29 tore Exp $
  + * $Id: PDFCIDSystemInfo.java,v 1.2.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,9 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
  +
   // based on work by Takayuki Takeuchi
   
   /**
  @@ -36,7 +39,11 @@
        * @return the PDF
        */
       public byte[] toPDF() {
  -        return toPDFString().getBytes();
  +        try {
  +            return toPDFString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return toPDFString().getBytes();
  +        }       
       }
   
       public String toPDFString() {
  
  
  
  1.30.2.3  +26 -4     xml-fop/src/org/apache/fop/pdf/PDFDocument.java
  
  Index: PDFDocument.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFDocument.java,v
  retrieving revision 1.30.2.2
  retrieving revision 1.30.2.3
  diff -u -r1.30.2.2 -r1.30.2.3
  --- PDFDocument.java	17 Feb 2002 23:14:10 -0000	1.30.2.2
  +++ PDFDocument.java	31 May 2002 00:17:16 -0000	1.30.2.3
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFDocument.java,v 1.30.2.2 2002/02/17 23:14:10 chrisg Exp $
  + * $Id: PDFDocument.java,v 1.30.2.3 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -27,6 +27,7 @@
   // Java
   import java.io.IOException;
   import java.io.OutputStream;
  +import java.io.UnsupportedEncodingException;
   import java.util.Vector;
   import java.util.Hashtable;
   import java.util.Enumeration;
  @@ -155,6 +156,11 @@
       protected Vector pendingLinks = null;
   
       /**
  +     * Encoding of the PDF
  +     */
  +    public static final String ENCODING = "ISO-8859-1";
  +
  +    /**
        * creates an empty PDF document <p>
        *
        * The constructor creates a /Root and /Pages object to
  @@ -1218,7 +1224,12 @@
       throws IOException {
           this.position=0;
   
  -        byte[] pdf = ("%PDF-" + this.pdfVersion + "\n").getBytes();
  +        byte[] pdf;
  +        try {
  +            pdf = ("%PDF-" + this.pdfVersion + "\n").getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            pdf = ("%PDF-" + this.pdfVersion + "\n").getBytes();
  +        }       
           stream.write(pdf);
           this.position += pdf.length;
   
  @@ -1265,7 +1276,13 @@
               "%%EOF\n";
   
           /* write the trailer */
  -        stream.write(pdf.getBytes());
  +        byte[] trailer;
  +        try {
  +            trailer = pdf.getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            trailer = pdf.getBytes();
  +        }       
  +        stream.write(trailer);
       }
   
       /**
  @@ -1297,7 +1314,12 @@
           }
   
           /* write the xref table and return the character length */
  -        byte[] pdfBytes = pdf.toString().getBytes();
  +        byte[] pdfBytes;
  +        try {
  +            pdfBytes = pdf.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            pdfBytes = pdf.toString().getBytes();
  +        }       
           stream.write(pdfBytes);
           return pdfBytes.length;
       }
  
  
  
  1.3.2.1   +8 -2      xml-fop/src/org/apache/fop/pdf/PDFEncoding.java
  
  Index: PDFEncoding.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFEncoding.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- PDFEncoding.java	30 Jul 2001 20:29:29 -0000	1.3
  +++ PDFEncoding.java	31 May 2002 00:17:16 -0000	1.3.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFEncoding.java,v 1.3 2001/07/30 20:29:29 tore Exp $
  + * $Id: PDFEncoding.java,v 1.3.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -8,6 +8,7 @@
   package org.apache.fop.pdf;
   
   // Java
  +import java.io.UnsupportedEncodingException;
   import java.util.Enumeration;
   import java.util.Hashtable;
   import java.util.Vector;
  @@ -106,7 +107,12 @@
               p.append(" ]");
           }
           p.append(" >>\nendobj\n");
  -        return p.toString().getBytes();
  +
  +        try {
  +            return p.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.toString().getBytes();
  +        }       
       }
   
       /*
  
  
  
  1.3.2.1   +10 -2     xml-fop/src/org/apache/fop/pdf/PDFFileSpec.java
  
  Index: PDFFileSpec.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFFileSpec.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- PDFFileSpec.java	30 Jul 2001 20:29:29 -0000	1.3
  +++ PDFFileSpec.java	31 May 2002 00:17:16 -0000	1.3.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFFileSpec.java,v 1.3 2001/07/30 20:29:29 tore Exp $
  + * $Id: PDFFileSpec.java,v 1.3.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,9 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
  +
   /**
    * class representing a /FileSpec object.
    *
  @@ -41,7 +44,12 @@
           String p = new String(this.number + " " + this.generation
                                 + " obj\n<<\n/Type /FileSpec\n" + "/F ("
                                 + this.filename + ")\n" + ">>\nendobj\n");
  -        return p.getBytes();
  +
  +        try {
  +            return p.getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.getBytes();
  +        }       
       }
   
       /*
  
  
  
  1.10.2.1  +10 -2     xml-fop/src/org/apache/fop/pdf/PDFFont.java
  
  Index: PDFFont.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFFont.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- PDFFont.java	30 Jul 2001 20:29:29 -0000	1.10
  +++ PDFFont.java	31 May 2002 00:17:16 -0000	1.10.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFFont.java,v 1.10 2001/07/30 20:29:29 tore Exp $
  + * $Id: PDFFont.java,v 1.10.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,9 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
  +
   /**
    * class representing a /Font object.
    *
  @@ -218,7 +221,12 @@
           }
           fillInPDF(p);
           p.append(" >>\nendobj\n");
  -        return p.toString().getBytes();
  +
  +        try {
  +            return p.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.toString().getBytes();
  +        }       
       }
   
       /**
  
  
  
  1.5.2.1   +10 -2     xml-fop/src/org/apache/fop/pdf/PDFFontDescriptor.java
  
  Index: PDFFontDescriptor.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFFontDescriptor.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- PDFFontDescriptor.java	30 Jul 2001 20:29:29 -0000	1.5
  +++ PDFFontDescriptor.java	31 May 2002 00:17:16 -0000	1.5.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFFontDescriptor.java,v 1.5 2001/07/30 20:29:29 tore Exp $
  + * $Id: PDFFontDescriptor.java,v 1.5.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,9 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
  +
   /**
    * class representing a font descriptor.
    *
  @@ -162,7 +165,12 @@
           // CID optional field
           fillInPDF(p);
           p.append("\n >>\nendobj\n");
  -        return p.toString().getBytes();
  +
  +        try {
  +            return p.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.toString().getBytes();
  +        }       
       }
   
       /**
  
  
  
  1.7.2.1   +7 -3      xml-fop/src/org/apache/fop/pdf/PDFFunction.java
  
  Index: PDFFunction.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFFunction.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- PDFFunction.java	30 Jul 2001 20:29:29 -0000	1.7
  +++ PDFFunction.java	31 May 2002 00:17:16 -0000	1.7.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFFunction.java,v 1.7 2001/07/30 20:29:29 tore Exp $
  + * $Id: PDFFunction.java,v 1.7.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -9,6 +9,7 @@
   
   // Java...
   import java.util.Vector;
  +import java.io.UnsupportedEncodingException;
   
   /**
    * class representing a PDF Function.
  @@ -663,8 +664,11 @@
   
           }
   
  -        return (p.toString().getBytes());
  -
  +        try {
  +            return p.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.toString().getBytes();
  +        }       
       }
   
   }
  
  
  
  1.6.2.1   +10 -2     xml-fop/src/org/apache/fop/pdf/PDFGoTo.java
  
  Index: PDFGoTo.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFGoTo.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- PDFGoTo.java	7 Sep 2001 09:26:16 -0000	1.6
  +++ PDFGoTo.java	31 May 2002 00:17:16 -0000	1.6.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFGoTo.java,v 1.6 2001/09/07 09:26:16 keiron Exp $
  + * $Id: PDFGoTo.java,v 1.6.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,9 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
  +
   /**
    * class representing a /GoTo object.
    *
  @@ -91,7 +94,12 @@
           String p = new String(this.number + " " + this.generation
                                 + " obj\n<<\n/S /GoTo\n" + destination
                                 + ">>\nendobj\n");
  -        return p.getBytes();
  +                              
  +        try {
  +            return p.getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.getBytes();
  +        }       
       }
   
       /*
  
  
  
  1.3.2.1   +10 -2     xml-fop/src/org/apache/fop/pdf/PDFGoToRemote.java
  
  Index: PDFGoToRemote.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFGoToRemote.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- PDFGoToRemote.java	30 Jul 2001 20:29:30 -0000	1.3
  +++ PDFGoToRemote.java	31 May 2002 00:17:16 -0000	1.3.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFGoToRemote.java,v 1.3 2001/07/30 20:29:30 tore Exp $
  + * $Id: PDFGoToRemote.java,v 1.3.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,9 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
  +
   /**
    * class representing a /GoToR object.
    */
  @@ -51,7 +54,12 @@
                                 + pdfFileSpec.referencePDF() + "\n"
                                 + "/D [ 0 /XYZ null null null ]"
                                 + " \n>>\nendobj\n");
  -        return p.getBytes();
  +
  +        try {
  +            return p.getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.getBytes();
  +        }       
       }
   
   
  
  
  
  1.1.2.2   +16 -3     xml-fop/src/org/apache/fop/pdf/PDFICCStream.java
  
  Index: PDFICCStream.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFICCStream.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- PDFICCStream.java	2 Dec 2001 22:17:30 -0000	1.1.2.1
  +++ PDFICCStream.java	31 May 2002 00:17:16 -0000	1.1.2.2
  @@ -1,11 +1,15 @@
   /*
  - * $Id: PDFICCStream.java,v 1.1.2.1 2001/12/02 22:17:30 tore Exp $
  + * $Id: PDFICCStream.java,v 1.1.2.2 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
   
   package org.apache.fop.pdf;
  +
  +// Java
  +import java.io.UnsupportedEncodingException;
  +// Fop
   import org.apache.fop.datatypes.ColorSpace;
   
   public class PDFICCStream extends PDFStream {
  @@ -45,11 +49,20 @@
   
           pb.append("/Length ").append((_data.size() + 1)).append(" ").append(filterEntry);
           pb.append(" >>\n");
  -        byte[] p = pb.toString().getBytes();
  +        byte[] p;
  +        try {
  +            p = pb.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            p = pb.toString().getBytes();
  +        }       
           stream.write(p);
           length += p.length;
           length += outputStreamData(stream);
  -        p = "endobj\n".getBytes();
  +        try {
  +            p = "endobj\n".getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            p = "endobj\n".getBytes();
  +        }       
           stream.write(p);
           length += p.length;
           return length;
  
  
  
  1.7.2.1   +7 -2      xml-fop/src/org/apache/fop/pdf/PDFInfo.java
  
  Index: PDFInfo.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFInfo.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- PDFInfo.java	30 Jul 2001 20:29:30 -0000	1.7
  +++ PDFInfo.java	31 May 2002 00:17:16 -0000	1.7.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFInfo.java,v 1.7 2001/07/30 20:29:30 tore Exp $
  + * $Id: PDFInfo.java,v 1.7.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -9,6 +9,7 @@
   
   // Java
   import java.io.IOException;
  +import java.io.UnsupportedEncodingException;
   import java.io.PrintWriter;
   
   /**
  @@ -48,7 +49,11 @@
           String p = this.number + " " + this.generation
                      + " obj\n<< /Type /Info\n/Producer (" + this.producer
                      + ") >>\nendobj\n";
  -        return p.getBytes();
  +        try {
  +            return p.getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.getBytes();
  +        }       
       }
   
   }
  
  
  
  1.6.2.1   +8 -2      xml-fop/src/org/apache/fop/pdf/PDFLink.java
  
  Index: PDFLink.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFLink.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- PDFLink.java	30 Jul 2001 20:29:30 -0000	1.6
  +++ PDFLink.java	31 May 2002 00:17:16 -0000	1.6.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFLink.java,v 1.6 2001/07/30 20:29:30 tore Exp $
  + * $Id: PDFLink.java,v 1.6.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -9,6 +9,7 @@
   
   // Java
   import java.awt.Rectangle;
  +import java.io.UnsupportedEncodingException;
   
   /**
    * class representing an /Annot object of /Subtype /Link
  @@ -56,7 +57,12 @@
                      + (brx / 1000f) + " " + (bry / 1000f) + " ]\n" + "/C [ "
                      + this.color + " ]\n" + "/Border [ 0 0 0 ]\n" + "/A "
                      + this.action.getAction() + "\n" + "/H /I\n>>\nendobj\n";
  -        return p.getBytes();
  +
  +        try {
  +            return p.getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.getBytes();
  +        }       
       }
   
       /*
  
  
  
  1.3.2.1   +8 -2      xml-fop/src/org/apache/fop/pdf/PDFOutline.java
  
  Index: PDFOutline.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFOutline.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- PDFOutline.java	2 Aug 2001 19:40:56 -0000	1.3
  +++ PDFOutline.java	31 May 2002 00:17:16 -0000	1.3.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFOutline.java,v 1.3 2001/08/02 19:40:56 tore Exp $
  + * $Id: PDFOutline.java,v 1.3.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,8 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
   import java.util.Vector;
   
   
  @@ -142,8 +144,12 @@
   
           }
           result.append(">> endobj\n");
  -        return result.toString().getBytes();
   
  +        try {
  +            return result.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return result.toString().getBytes();
  +        }       
       }
   
       /**
  
  
  
  1.12.2.1  +8 -2      xml-fop/src/org/apache/fop/pdf/PDFPage.java
  
  Index: PDFPage.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFPage.java,v
  retrieving revision 1.12
  retrieving revision 1.12.2.1
  diff -u -r1.12 -r1.12.2.1
  --- PDFPage.java	1 Aug 2001 22:12:52 -0000	1.12
  +++ PDFPage.java	31 May 2002 00:17:16 -0000	1.12.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFPage.java,v 1.12 2001/08/01 22:12:52 gears Exp $
  + * $Id: PDFPage.java,v 1.12.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,8 @@
   
   package org.apache.fop.pdf;
   
  +import java.io.UnsupportedEncodingException;
  +
   /**
    * class representing a /Page object.
    *
  @@ -129,7 +131,11 @@
   
           sb = sb.append(">>\nendobj\n");
   
  -        return sb.toString().getBytes();
  +        try {
  +            return sb.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return sb.toString().getBytes();
  +        }       
       }
   
   }
  
  
  
  1.12.2.1  +10 -3     xml-fop/src/org/apache/fop/pdf/PDFPages.java
  
  Index: PDFPages.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFPages.java,v
  retrieving revision 1.12
  retrieving revision 1.12.2.1
  diff -u -r1.12 -r1.12.2.1
  --- PDFPages.java	1 Aug 2001 23:08:55 -0000	1.12
  +++ PDFPages.java	31 May 2002 00:17:16 -0000	1.12.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFPages.java,v 1.12 2001/08/01 23:08:55 gears Exp $
  + * $Id: PDFPages.java,v 1.12.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -9,8 +9,10 @@
   
   // Java
   import java.io.PrintWriter;
  -import org.apache.fop.messaging.MessageHandler;
  +import java.io.UnsupportedEncodingException;
   import java.util.Vector;
  +// Fop
  +import org.apache.fop.messaging.MessageHandler;
   
   /**
    * class representing a /Pages object.
  @@ -88,7 +90,12 @@
               p = p.append(kids.elementAt(i) + " ");
           }
           p = p.append("] >>\nendobj\n");
  -        return p.toString().getBytes();
  +
  +        try {
  +            return p.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.toString().getBytes();
  +        }       
       }
   
   }
  
  
  
  1.8.2.1   +7 -5      xml-fop/src/org/apache/fop/pdf/PDFPattern.java
  
  Index: PDFPattern.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFPattern.java,v
  retrieving revision 1.8
  retrieving revision 1.8.2.1
  diff -u -r1.8 -r1.8.2.1
  --- PDFPattern.java	30 Jul 2001 20:29:30 -0000	1.8
  +++ PDFPattern.java	31 May 2002 00:17:16 -0000	1.8.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFPattern.java,v 1.8 2001/07/30 20:29:30 tore Exp $
  + * $Id: PDFPattern.java,v 1.8.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -8,6 +8,7 @@
   package org.apache.fop.pdf;
   
   // Java...
  +import java.io.UnsupportedEncodingException;
   import java.util.Vector;
   
   // FOP...
  @@ -288,10 +289,11 @@
   
           p.append("endobj\n");
   
  -
  -
  -        return (p.toString().getBytes());
  -
  +        try {
  +            return p.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.toString().getBytes();
  +        }       
       }
   
   }
  
  
  
  1.4.2.1   +9 -2      xml-fop/src/org/apache/fop/pdf/PDFRectangle.java
  
  Index: PDFRectangle.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFRectangle.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- PDFRectangle.java	30 Jul 2001 20:29:30 -0000	1.4
  +++ PDFRectangle.java	31 May 2002 00:17:16 -0000	1.4.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFRectangle.java,v 1.4 2001/07/30 20:29:30 tore Exp $
  + * $Id: PDFRectangle.java,v 1.4.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,9 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
  +
   /**
    * class representing a rectangle
    *
  @@ -67,7 +70,11 @@
        * @return the PDF
        */
       public byte[] toPDF() {
  -        return toPDFString().getBytes();
  +        try {
  +            return toPDFString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return toPDFString().getBytes();
  +        }       
       }
   
       public String toPDFString() {
  
  
  
  1.10.2.1  +7 -2      xml-fop/src/org/apache/fop/pdf/PDFResources.java
  
  Index: PDFResources.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFResources.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- PDFResources.java	30 Jul 2001 20:29:30 -0000	1.10
  +++ PDFResources.java	31 May 2002 00:17:16 -0000	1.10.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFResources.java,v 1.10 2001/07/30 20:29:30 tore Exp $
  + * $Id: PDFResources.java,v 1.10.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -9,6 +9,7 @@
   
   // Java
   import java.io.PrintWriter;
  +import java.io.UnsupportedEncodingException;
   import java.util.Enumeration;
   import java.util.Vector;
   import java.util.Hashtable;
  @@ -138,7 +139,11 @@
   
           p = p.append(">> \nendobj\n");
   
  -        return p.toString().getBytes();
  +        try {
  +            return p.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.toString().getBytes();
  +        }       
       }
   
   }
  
  
  
  1.10.2.1  +8 -2      xml-fop/src/org/apache/fop/pdf/PDFRoot.java
  
  Index: PDFRoot.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFRoot.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- PDFRoot.java	1 Aug 2001 23:08:55 -0000	1.10
  +++ PDFRoot.java	31 May 2002 00:17:16 -0000	1.10.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFRoot.java,v 1.10 2001/08/01 23:08:55 gears Exp $
  + * $Id: PDFRoot.java,v 1.10.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -9,6 +9,7 @@
   
   // Java
   import java.io.IOException;
  +import java.io.UnsupportedEncodingException;
   import java.io.PrintWriter;
   
   /**
  @@ -96,7 +97,12 @@
   
           }
           p.append(" >>\nendobj\n");
  -        return p.toString().getBytes();
  +
  +        try {
  +            return p.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.toString().getBytes();
  +        }       
       }
   
   }
  
  
  
  1.7.2.1   +7 -2      xml-fop/src/org/apache/fop/pdf/PDFShading.java
  
  Index: PDFShading.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFShading.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- PDFShading.java	30 Jul 2001 20:29:30 -0000	1.7
  +++ PDFShading.java	31 May 2002 00:17:16 -0000	1.7.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFShading.java,v 1.7 2001/07/30 20:29:30 tore Exp $
  + * $Id: PDFShading.java,v 1.7.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -8,6 +8,7 @@
   package org.apache.fop.pdf;
   
   // Java...
  +import java.io.UnsupportedEncodingException;
   import java.util.Vector;
   
   // FOP
  @@ -505,7 +506,11 @@
   
           p.append(">> \nendobj\n");
   
  -        return (p.toString().getBytes());
  +        try {
  +            return p.toString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return p.toString().getBytes();
  +        }       
       }
   
   }
  
  
  
  1.10.2.1  +53 -12    xml-fop/src/org/apache/fop/pdf/PDFStream.java
  
  Index: PDFStream.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFStream.java,v
  retrieving revision 1.10
  retrieving revision 1.10.2.1
  diff -u -r1.10 -r1.10.2.1
  --- PDFStream.java	30 Jul 2001 20:29:30 -0000	1.10
  +++ PDFStream.java	31 May 2002 00:17:16 -0000	1.10.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFStream.java,v 1.10 2001/07/30 20:29:30 tore Exp $
  + * $Id: PDFStream.java,v 1.10.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,11 +7,14 @@
   
   package org.apache.fop.pdf;
   
  +// Java
   import java.io.ByteArrayOutputStream;
   import java.io.OutputStream;
   import java.io.IOException;
  +import java.io.UnsupportedEncodingException;
   import java.util.Vector;
   import java.util.Enumeration;
  +// Fop
   import org.apache.fop.configuration.Configuration;
   import org.apache.fop.messaging.MessageHandler;
   
  @@ -53,7 +56,11 @@
        */
       public void add(String s) {
           try {
  -            _data.write(s.getBytes());
  +            try {
  +                _data.write(s.getBytes(PDFDocument.ENCODING));
  +            } catch (UnsupportedEncodingException ue) {
  +                _data.write(s.getBytes());
  +            }
           } catch (IOException ex) {
               ex.printStackTrace();
           }
  @@ -133,19 +140,35 @@
                       if (r < 16) {
                           _data.write('0');
                       }
  -                    _data.write(Integer.toHexString(r).getBytes());
  +                    try {
  +                        _data.write(Integer.toHexString(r).getBytes(PDFDocument.ENCODING));
  +                    } catch (UnsupportedEncodingException ue) {
  +                        _data.write(Integer.toHexString(r).getBytes());
  +                    }
                       if (g < 16) {
                           _data.write('0');
                       }
  -                    _data.write(Integer.toHexString(g).getBytes());
  +                    try {
  +                        _data.write(Integer.toHexString(g).getBytes(PDFDocument.ENCODING));
  +                    } catch (UnsupportedEncodingException ue) {
  +                        _data.write(Integer.toHexString(g).getBytes());
  +                    }
                       if (b < 16) {
                           _data.write('0');
                       }
  -                    _data.write(Integer.toHexString(b).getBytes());
  +                    try {
  +                        _data.write(Integer.toHexString(b).getBytes(PDFDocument.ENCODING));
  +                    } catch (UnsupportedEncodingException ue) {
  +                        _data.write(Integer.toHexString(b).getBytes());
  +                    }
                       _data.write(' ');
                   }
               }
  -            _data.write(">\n".getBytes());
  +            try {
  +                _data.write(">\n".getBytes(PDFDocument.ENCODING));
  +            } catch (UnsupportedEncodingException ue) {
  +                _data.write(">\n".getBytes());
  +            }
           } catch (IOException ex) {
               ex.printStackTrace();
           }
  @@ -195,14 +218,23 @@
       protected int output(OutputStream stream) throws IOException {
           int length = 0;
           String filterEntry = applyFilters();
  -        byte[] p = (this.number + " " + this.generation + " obj\n<< /Length "
  +        String s = this.number + " " + this.generation + " obj\n<< /Length "
                       + (_data.size() + 1) + " " + filterEntry
  -                    + " >>\n").getBytes();
  -
  +                    + " >>\n";
  +        byte[] p;
  +        try {
  +            p = s.getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            p = s.getBytes();
  +        }
           stream.write(p);
           length += p.length;
           length += outputStreamData(stream);
  -        p = "endobj\n".getBytes();
  +        try {
  +            p = "endobj\n".getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            p = "endobj\n".getBytes();
  +        }
           stream.write(p);
           length += p.length;
           return length;
  @@ -214,12 +246,21 @@
        */
       protected int outputStreamData(OutputStream stream) throws IOException {
           int length = 0;
  -        byte[] p = "stream\n".getBytes();
  +        byte[] p;
  +        try {
  +            p = "stream\n".getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            p = "stream\n".getBytes();
  +        }
           stream.write(p);
           length += p.length;
           _data.writeTo(stream);
           length += _data.size();
  -        p = "\nendstream\n".getBytes();
  +        try {
  +            p = "\nendstream\n".getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            p = "\nendstream\n".getBytes();
  +        }
           stream.write(p);
           length += p.length;
           return length;
  
  
  
  1.2.2.2   +47 -8     xml-fop/src/org/apache/fop/pdf/PDFT1Stream.java
  
  Index: PDFT1Stream.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFT1Stream.java,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- PDFT1Stream.java	2 Dec 2001 22:17:30 -0000	1.2.2.1
  +++ PDFT1Stream.java	31 May 2002 00:17:16 -0000	1.2.2.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFT1Stream.java,v 1.2.2.1 2001/12/02 22:17:30 tore Exp $
  + * $Id: PDFT1Stream.java,v 1.2.2.2 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,9 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
  +
   public class PDFT1Stream extends PDFStream {
       private int origLength;
       private int len1, len3;
  @@ -41,7 +44,12 @@
           // Get the first binary number and search backwards for "eexec"
           len1 = 30;
   
  -        byte[] eexec = (new String("currentfile eexec")).getBytes();
  +        byte[] eexec;
  +        try {
  +            eexec = "currentfile eexec".getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            eexec = "currentfile eexec".getBytes();
  +        }       
           // System.out.println("Length1="+len1);
           while (!byteCmp(originalData, len1 - eexec.length, eexec))
               len1++;
  @@ -50,7 +58,13 @@
   
           // Length3 is length of the last portion of the file
           len3 = 0;
  -        byte[] cltom = (new String("cleartomark")).getBytes();
  +        byte[] cltom;
  +        try {
  +            cltom = "cleartomark".getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            cltom = "cleartomark".getBytes();
  +        }       
  +        
           len3 -= cltom.length;
           while (!byteCmp(originalData, origLength + len3, cltom)) {
               len3--;
  @@ -60,9 +74,24 @@
           len3++;
           // Eat 512 zeroes
           int numZeroes = 0;
  -        byte[] ws1 = "\n".getBytes();
  -        byte[] ws2 = "\r".getBytes();
  -        byte[] ws3 = "0".getBytes();
  +        byte[] ws1;
  +        try {
  +            ws1 = "\n".getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            ws1 = "\n".getBytes();
  +        }       
  +        byte[] ws2;
  +        try {
  +            ws2 = "\r".getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            ws2 = "\r".getBytes();
  +        }       
  +        byte[] ws3;
  +        try {
  +            ws3 = "0".getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            ws3 = "0".getBytes();
  +        }       
           while ((originalData[origLength - len3] == ws1[0] || originalData[origLength - len3] == ws2[0] || originalData[origLength - len3] == ws3[0])
                  && numZeroes < 512) {
               len3++;
  @@ -85,12 +114,22 @@
                                       + (origLength - len3 - len1)
                                       + " /Length3 " + len3 + " >>\n");
   
  -        byte[] p = preData.getBytes();
  +        byte[] p;
  +        try {
  +            p = preData.getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            p = preData.getBytes();
  +        }       
  +
           stream.write(p);
           length += p.length;
   
           length += outputStreamData(stream);
  -        p = "endobj\n".getBytes();
  +        try {
  +            p = "endobj\n".getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            p = "endobj\n".getBytes();
  +        }       
           stream.write(p);
           length += p.length;
           //System.out.println("Embedded Type1 font");
  
  
  
  1.2.2.2   +16 -3     xml-fop/src/org/apache/fop/pdf/PDFTTFStream.java
  
  Index: PDFTTFStream.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFTTFStream.java,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- PDFTTFStream.java	2 Dec 2001 22:17:30 -0000	1.2.2.1
  +++ PDFTTFStream.java	31 May 2002 00:17:16 -0000	1.2.2.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFTTFStream.java,v 1.2.2.1 2001/12/02 22:17:30 tore Exp $
  + * $Id: PDFTTFStream.java,v 1.2.2.2 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,9 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
  +
   public class PDFTTFStream extends PDFStream {
       private int origLength;
   
  @@ -27,12 +30,22 @@
                                       + " " + "/Length1 " + origLength
                                       + " >>\n");
   
  -        byte[] p = preData.getBytes();
  +        byte[] p;
  +        try {
  +            p = preData.getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            p = preData.getBytes();
  +        }       
  +        
           stream.write(p);
           length += p.length;
   
           length += outputStreamData(stream);
  -        p = "endobj\n".getBytes();
  +        try {
  +            p = "endobj\n".getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            p = "endobj\n".getBytes();
  +        }       
           stream.write(p);
           length += p.length;
           return length;
  
  
  
  1.4.2.1   +8 -2      xml-fop/src/org/apache/fop/pdf/PDFWArray.java
  
  Index: PDFWArray.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFWArray.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- PDFWArray.java	30 Jul 2001 20:29:30 -0000	1.4
  +++ PDFWArray.java	31 May 2002 00:17:16 -0000	1.4.2.1
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFWArray.java,v 1.4 2001/07/30 20:29:30 tore Exp $
  + * $Id: PDFWArray.java,v 1.4.2.1 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -7,6 +7,8 @@
   
   package org.apache.fop.pdf;
   
  +// Java
  +import java.io.UnsupportedEncodingException;
   import java.util.Vector;
   
   /**
  @@ -63,7 +65,11 @@
       }
   
       public byte[] toPDF() {
  -        return toPDFString().getBytes();
  +        try {
  +            return toPDFString().getBytes(PDFDocument.ENCODING);
  +        } catch (UnsupportedEncodingException ue) {
  +            return toPDFString().getBytes();
  +        }       
       }
   
       public String toPDFString() {
  
  
  
  1.14.2.2  +37 -8     xml-fop/src/org/apache/fop/pdf/PDFXObject.java
  
  Index: PDFXObject.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/pdf/PDFXObject.java,v
  retrieving revision 1.14.2.1
  retrieving revision 1.14.2.2
  diff -u -r1.14.2.1 -r1.14.2.2
  --- PDFXObject.java	2 Dec 2001 22:17:30 -0000	1.14.2.1
  +++ PDFXObject.java	31 May 2002 00:17:16 -0000	1.14.2.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: PDFXObject.java,v 1.14.2.1 2001/12/02 22:17:30 tore Exp $
  + * $Id: PDFXObject.java,v 1.14.2.2 2002/05/31 00:17:16 chrisg Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -12,11 +12,12 @@
   
   // Java
   import java.io.IOException;
  -import org.apache.fop.messaging.MessageHandler;
  +import java.io.UnsupportedEncodingException;
   import java.io.OutputStream;
   
   // FOP
   import org.apache.fop.datatypes.ColorSpace;
  +import org.apache.fop.messaging.MessageHandler;
   import org.apache.fop.pdf.PDFDocument;
   import org.apache.fop.pdf.PDFICCStream;
   import org.apache.fop.image.FopImage;
  @@ -119,8 +120,18 @@
                   post.append("PreEPS_state restore\n");
                   post.append("end % userdict\n");
   
  -                byte[] preBytes = preamble.toString().getBytes();
  -                byte[] postBytes = post.toString().getBytes();
  +                byte[] preBytes;
  +                try {
  +                    preBytes = preamble.toString().getBytes(PDFDocument.ENCODING);
  +                } catch (UnsupportedEncodingException ue) {
  +                    preBytes = preamble.toString().getBytes();
  +                }       
  +                byte[] postBytes;
  +                try {
  +                    postBytes = post.toString().getBytes(PDFDocument.ENCODING);
  +                } catch (UnsupportedEncodingException ue) {
  +                    postBytes = post.toString().getBytes();
  +                }       
                   byte[] imgData = new byte[preBytes.length + postBytes.length + fopimage.getBitmaps().length];
   
                   System.arraycopy (preBytes, 0, imgData, 0, preBytes.length);
  @@ -145,13 +156,22 @@
                   p = p + ">>\n";
   
                   // push the pdf dictionary on the writer
  -                byte[] pdfBytes = p.getBytes();
  +                byte[] pdfBytes;
  +                try {
  +                    pdfBytes = p.getBytes(PDFDocument.ENCODING);
  +                } catch (UnsupportedEncodingException ue) {
  +                    pdfBytes = p.getBytes();
  +                }       
                   stream.write(pdfBytes);
                   length += pdfBytes.length;
                   // push all the image data on  the writer and takes care of length for trailer
                   length += imgStream.outputStreamData(stream);
   
  -                pdfBytes = ("endobj\n").getBytes();
  +                try {
  +                    pdfBytes = ("endobj\n").getBytes(PDFDocument.ENCODING);
  +                } catch (UnsupportedEncodingException ue) {
  +                    pdfBytes = ("endobj\n").getBytes();
  +                }       
                   stream.write(pdfBytes);
                   length += pdfBytes.length;
   
  @@ -210,13 +230,22 @@
                   fopimage.close();
   
                   // push the pdf dictionary on the writer
  -                byte[] pdfBytes = p.getBytes();
  +                byte[] pdfBytes;
  +                try {
  +                    pdfBytes = p.getBytes(PDFDocument.ENCODING);
  +                } catch (UnsupportedEncodingException ue) {
  +                    pdfBytes = p.getBytes();
  +                }       
                   stream.write(pdfBytes);
                   length += pdfBytes.length;
                   // push all the image data on  the writer and takes care of length for trailer
                   length += imgStream.outputStreamData(stream);
   
  -                pdfBytes = ("endobj\n").getBytes();
  +                try {
  +                    pdfBytes = ("endobj\n").getBytes(PDFDocument.ENCODING);
  +                } catch (UnsupportedEncodingException ue) {
  +                    pdfBytes = ("endobj\n").getBytes();
  +                }       
                   stream.write(pdfBytes);
                   length += pdfBytes.length;
               }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org