You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by "Hamacher, Eric" <Er...@gallup.com> on 2009/03/06 18:01:19 UTC

binary characters in FO-PDF conversion

Hello:

I have a an XML document and an xslt document which contains a binary character.  When I try to convert it to a PDF, part of the PDF is garbled and deformed.  The transformation works with XEP, so the documents are OK.  I think that the binary character may be causing this problem but I'm not sure.  How do I deal with these characters?  Here is my code:


    public File transform(Document xml, Document xslt, String id) {
        FopFactory fopFactory = FopFactory.newInstance();
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        File pdfFile = new File(System.getProperty("PDFSaveLocation") + "/" + id + "pdf.pdf");
        OutputStream out = null;

        try {
            out = new java.io.FileOutputStream(pdfFile);
            out = new java.io.BufferedOutputStream(out);
            Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer(new DOMSource(xslt));
            Source src = new DOMSource(xml);
            Result res = new SAXResult(fop.getDefaultHandler());
            transformer.transform(src, res);

        }
        catch(Throwable t) {
            t.printStackTrace(System.err);
        }
        finally {
            try {
                out.close();
            }
            catch (Exception e) {

            }
        }
        return pdfFile;
    }

J.  ERIC  HAMACHER
Software Application Developer
608.664.3859
8476 Greenway Boulevard
Suite 100
Middleton, WI  53562
USA
GALLUP Technology

Achiever | Learner | Restorative | Intellection | Deliberative


Re: binary characters in FO-PDF conversion

Posted by Andreas Delmelle <an...@telenet.be>.
On 06 Mar 2009, at 18:01, Hamacher, Eric wrote:

Hi

> I have a an XML document and an xslt document which contains a  
> binary character.  When I try to convert it to a PDF, part of the  
> PDF is garbled and deformed.  The transformation works with XEP, so  
> the documents are OK.  I think that the binary character may be  
> causing this problem but I’m not sure.  How do I deal with these  
> characters?  Here is my code:

Which 'binary' are you referring to exactly?
Can you dump the resulting FO and mail it to us, so we can check for  
ourselves? If it's rather large or contains confidential information,  
just send it off-list, so it's not sent to all subscribers. To  
localize the problem, it would be helpful if you could minimize the FO  
(the smallest possible that triggers the issue)


Thanks

Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org