xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Rost <marcelr...@gmx.net>
Subject Problem using FOP 1.0 with Java
Date Thu, 19 Apr 2012 17:20:02 GMT


we have a problem with FOP 1.0 and Java

Application setup
Java (no possibility to upgrade)
FOP 1.0

We used FOP-0.20.5 together with Java and upgraded the FOP version
to 1.0.
Before the upgrade we were able to create digital prints as text using the
AWTRenderer. If we send the output to a driver like PDFCreator the output
was a PDF with embedded fonts.

With the new FOP version I am using the PageableRenderer. If you send such a
file to a driver like PDFCreator, the text within the PDF is not selectable
anymore as it is rendered as vector graphics.
Creating PDF files with the PDFRenderer works fine. The font is embedded

As you can see in the examples the text is rendered as vector graphics
instead using the fonts.
This causes that afterwards we cannot access the printed text from the
printout again. (which we needed for further processing)

We tried out to run our application on Java6 and Java7 and there we got the
result like with FOP-0.20.5.

What can be excluded are corrupt stylesheets as we encountered the same
problem using the helloworld from the "Quick Start Guide".

The way we trigger the printing for FOP 1.0:


        //Set up PrinterJob instance
        PrinterJob printerJob = PrinterJob.getPrinterJob();
        printerJob.setJobName("FOP Printing Example");

        try {
            //Set up a custom user agent so we can supply our own renderer
            FOUserAgent userAgent = fopFactory.newFOUserAgent();
            PageableRenderer pageableRenderer = new PageableRenderer();
            // Construct FOP with desired output format
            Fop fop = fopFactory.newFop(MimeConstants.MIME_FOP_PRINT,

            // Setup JAXP using identity transformer
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer(); // identity

            // Setup input stream
            Source src = new StreamSource(fo);

            // Resulting SAX events (the generated FO) must be piped through
to FOP
            Result res = new SAXResult(fop.getDefaultHandler());

            // Start XSLT transformation and FOP processing
            transformer.transform(src, res);
            if (printerJob.printDialog()) {
        } catch (Exception e) {


Are there any problems or workarounds known with the constellation of FOP
1.0 and Java

Example PDF files from different JDKs:

Java 6

Best regards, 
Marcel Rost
View this message in context: http://old.nabble.com/Problem-using-FOP-1.0-with-Java-
Sent from the FOP - Users mailing list archive at Nabble.com.

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

View raw message