RE: Compressed PDF

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 UTC