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 ke...@apache.org on 2002/07/01 12:39:30 UTC

cvs commit: xml-fop/src/org/apache/fop/pdf PDFDocument.java PDFPattern.java PDFXObject.java

keiron      2002/07/01 03:39:30

  Modified:    src/org/apache/fop/pdf PDFDocument.java PDFPattern.java
                        PDFXObject.java
  Log:
  fixed some minor errors
  
  Revision  Changes    Path
  1.43      +4 -2      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.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- PDFDocument.java	28 Jun 2002 10:09:06 -0000	1.42
  +++ PDFDocument.java	1 Jul 2002 10:39:29 -0000	1.43
  @@ -825,6 +825,7 @@
               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 @@
                                        makeArray(metrics.getWidths(1)));
               }
   
  +            fontMap.put(basefont, font);
  +
               return font;
           }
       }
  @@ -1005,7 +1008,6 @@
                                      pagewidth, pageheight);
   
           /* add it to the list of objects */
  -        this.objects.add(page);
           pages.addPage(page);
           return page;
       }
  
  
  
  1.13      +16 -22    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.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PDFPattern.java	28 Jun 2002 10:09:06 -0000	1.12
  +++ PDFPattern.java	1 Jul 2002 10:39:29 -0000	1.13
  @@ -10,7 +10,7 @@
   // 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 @@
        *
        * @return the PDF string.
        */
  -    public byte[] toPDF() {
  -
  +    protected int output(OutputStream stream) throws IOException {
   
           int vectorSize = 0;
           int tempInt = 0;
  @@ -251,11 +250,7 @@
                   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 @@
   
           p.append(">> \n");
   
  +        String dict = p.toString();
  +        int length = dict.length();
  +
  +        stream.write(dict.getBytes());
  +
           // stream representing the function
           if (dataStream != null) {
  -            try {
  -                ByteArrayOutputStream baos = new ByteArrayOutputStream();
  -                baos.write(p.toString().getBytes());
  -                int length = dataStream.outputStreamData(baos);
  -
  -                baos.write(("endobj\n").getBytes());
  -                return baos.toByteArray();
  -            } catch(IOException e) {
  -
  -            }
  +            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; }
   
   }
  
  
  
  1.20      +3 -3      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.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- PDFXObject.java	27 Jun 2002 11:45:54 -0000	1.19
  +++ PDFXObject.java	1 Jul 2002 10:39:29 -0000	1.20
  @@ -62,7 +62,7 @@
               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 @@
           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";
  
  
  

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