W3C home > Mailing lists > Public > www-xsl-fo@w3.org > May 2001

RE: Compressed PDF

From: Kelly Campbell <camk@channelpoint.com>
Date: Thu, 24 May 2001 15:20:22 -0600
Message-ID: <E583503B7F57D41196A600D0B76FDDD5DD0B8B@cpex.channelpoint.com>
To: "'Gian Piero Canciani'" <gp.canciani@iol.it>, www-xsl-fo@w3.org
As Arved stated Tuesday, this is a question about a specific implementation
(FOP) and not xsl-fo in general. You'll get better results by asking such
implementation specific questions on the mailing list for that particular
implementation, fop-dev@xml.apache.org in this case.

In general, using Java StringBuffers, Strings, Writers, and Readers is a bad
idea when dealing with binary data such as PDF. The PDF specification
provides specific ways to handle encoding of non-ascii character sets, as
well as binary image and other stream data. So it would be best if you can
use a ByteArray rather than a String or StringBuffer in this case. Even if
you do turn off compression, there is nothing to guarantee that the PDF
won't contain other binary data, especially if it has non-ascii characters.
If you do want to turn off compression, search in the fop-dev archives or
the FAQ for the answer.

-Kelly


-----Original Message-----
From: Gian Piero Canciani [mailto:gp.canciani@iol.it]
Sent: Thursday, May 24, 2001 2:46 PM
To: www-xsl-fo@w3.org
Subject: Compressed PDF


Using FOP 0.17 I obtained a PDF output containing normal (printable)
characters.
Now, with the same application but with 0.18 version, the generated PDF 
document contains special
characters (meaning that the produced format is a compressed PDF; the 
file size is smaller also).

- I have to use a StringBuffer to return the document.
- I specify a ByteArrayOutputStream to the setOutputStream() method.
- Once filled the output stream by render(), I return the StringBuffer 
as follow:
  return new StringBuffer(outstreamobj.toString());
But the problem is that:
- The StringBuffer constructor maps special characters (hex > 80) in 3F.
- Consequently, the StringBuffer contains a compressed (but incorrect!) 
PDF.

Is it possible to call the Driver's render() method asking for a non-
compressed PDF output ?

Thanks,
Gian Piero Canciani
Received on Thursday, 24 May 2001 17:21:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 3 October 2007 16:06:08 GMT