xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hamacher, Eric" <Eric_Hamac...@gallup.com>
Subject binary characters in FO-PDF conversion
Date Fri, 06 Mar 2009 17:01:19 GMT
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


Mime
View raw message