Bug #: 51210
           Summary: FO transform to PDF completely in memory!? =>
           Product: Fop
           Version: 1.0
          Platform: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: general
    Classification: Unclassified

So far, we had no problems transforming *.fo files with FOP 1.0 to PDF. Now, we
get OutOfMemoryErrors for *.fo files of about 150 MB and bigger. We tried the
64 Bit JVM with -Xmx2048m and still get OutOfMemoryError after a while.

During the long period of PDF transformation we noticed that the destination
*.pdf file is not increasing in size but stays at 0 KB! Therefore, it seems
that FOP/Transform is trying to generate the PDF completely in RAM!?

My transformation method:

     * Transform XSL-FO.
     * @param nameOfInputFile Name of input FO file (e.g. "").
     * @param nameOfOutputFile Name of output PDF file (e.g. "Test.pdf").
     * @param mimeType MIME type for the output format (e.g.
     * @return The generated PDF file or null if failed.
     * @throws Exception on error.
     * @since 4.15.0
     * @see <a
    public final File transformFO(final String nameOfInputFile, final String
nameOfOutputFile, final String mimeType) throws Exception {
        File result = null;

        OutputStream os = null;
        try {
            final File fileOutput = new File(nameOfOutputFile);
            os = new BufferedOutputStream(new FileOutputStream(fileOutput));

            final Fop fop = fopFactory.newFop(mimeType, foUserAgent, os);
            final StreamSource ssFO = new StreamSource(new
            final Transformer transformer = factory.newTransformer(); 

            transformer.setErrorListener(new ErrorListener() {
                public void error(TransformerException exception) throws
TransformerException {
"+exception.getMessage(), exception);

                public void fatalError(TransformerException exception) throws
TransformerException {
"+exception.getMessage(), exception);

                public void warning(TransformerException exception) throws
TransformerException {
"+exception.getMessage(), exception);

            final Result res = new SAXResult(fop.getDefaultHandler());
            transformer.transform(ssFO, res);

            if (LOGGER.isLoggable(Level.FINE)) {
                final FormattingResults foResults = fop.getResults();
                LOGGER.fine("Generated " + foResults.getPageCount() + " PDF
pages in total:");
                final List<PageSequenceResults> pss =
                for (final PageSequenceResults psr : pss) {
                    LOGGER.fine("PageSequence " +
(String.valueOf(psr.getID()).length() > 0 ? psr.getID() : "<no id>") + "
generated " + psr.getPageCount() + " pages.");

            result = fileOutput;
        } finally {
            if (os != null) { os.close(); }

        return result;

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

Reply via email to