[jira] [Updated] (FOP-3293) Support for caching of pdf image object streams

"Simon Steiner (Jira)" <[email protected]> Mon, 9 Feb 2026 11:45:00 +0000 (UTC)
Newsgroups gmane.text.xml.fop.devel
Message-ID <[email protected]>
     [ https://issues.apache.org/jira/browse/FOP-3293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Steiner updated FOP-3293:
-------------------------------
    Description: 
Cache parsed image to speed up pdf rendering

    @Test
    public void x() throws Exception {
        FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
        y(fopFactory);
        long time = System.currentTimeMillis();
        y(fopFactory);
        System.out.println(System.currentTimeMillis() - time);
    }

    private void y(FopFactory fopFactory) throws Exception {
        String fo = "<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\">\n" +
                "  <fo:layout-master-set>\n" +
                "    <fo:simple-page-master master-name=\"simple\" page-height=\"27.9cm\" page-width=\"21.6cm\">\n" +
                "      <fo:region-body />\n" +
                "    </fo:simple-page-master>\n" +
                "  </fo:layout-master-set>\n" +
                "  <fo:page-sequence master-reference=\"simple\">\n" +
                "    <fo:flow flow-name=\"xsl-region-body\">\n" +
                "<fo:block><fo:external-graphic src=\"/xxx/sessiondata.png\"/></fo:block> \n"+
                "</fo:flow>\n" +
                "  </fo:page-sequence>\n" +
                "</fo:root>\n";
        FOUserAgent userAgent = fopFactory.newFOUserAgent();
        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new FileOutputStream("/home/simon/shared/slowJob2/out2.pdf"));
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        Source src = new StreamSource(new ByteArrayInputStream(fo.getBytes()));
        Result res = new SAXResult(fop.getDefaultHandler());
        transformer.transform(src, res);
    }

  was:a


> Support for caching of pdf image object streams
> -----------------------------------------------
>
>                 Key: FOP-3293
>                 URL: https://issues.apache.org/jira/browse/FOP-3293
>             Project: FOP
>          Issue Type: Bug
>            Reporter: Simon Steiner
>            Assignee: Simon Steiner
>            Priority: Major
>
> Cache parsed image to speed up pdf rendering
>     @Test
>     public void x() throws Exception {
>         FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI());
>         y(fopFactory);
>         long time = System.currentTimeMillis();
>         y(fopFactory);
>         System.out.println(System.currentTimeMillis() - time);
>     }
>     private void y(FopFactory fopFactory) throws Exception {
>         String fo = "<fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\">\n" +
>                 "  <fo:layout-master-set>\n" +
>                 "    <fo:simple-page-master master-name=\"simple\" page-height=\"27.9cm\" page-width=\"21.6cm\">\n" +
>                 "      <fo:region-body />\n" +
>                 "    </fo:simple-page-master>\n" +
>                 "  </fo:layout-master-set>\n" +
>                 "  <fo:page-sequence master-reference=\"simple\">\n" +
>                 "    <fo:flow flow-name=\"xsl-region-body\">\n" +
>                 "<fo:block><fo:external-graphic src=\"/xxx/sessiondata.png\"/></fo:block> \n"+
>                 "</fo:flow>\n" +
>                 "  </fo:page-sequence>\n" +
>                 "</fo:root>\n";
>         FOUserAgent userAgent = fopFactory.newFOUserAgent();
>         Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, new FileOutputStream("/home/simon/shared/slowJob2/out2.pdf"));
>         Transformer transformer = TransformerFactory.newInstance().newTransformer();
>         Source src = new StreamSource(new ByteArrayInputStream(fo.getBytes()));
>         Result res = new SAXResult(fop.getDefaultHandler());
>         transformer.transform(src, res);
>     }



--
This message was sent by Atlassian Jira
(v8.20.10#820010)