1

On Wildfly 10.0 deployed EAR application, in which is generated PDF document. Generation occurs during a call to the REST service and uses Apache FOP 2.3. When the service is first called after restarting / re-deploying the application generation is performed for almost 6 seconds, the subsequent ones in 0.7 seconds.

Document generation scheme:

  1. Generate XML with data and XSLT with design.
  2. Create FopFactory -> get RenderFactory of FopFactory -> get new FOUserAgent of FopFactory.
  3. Create fop of FopFactory (based MIME_PDF, FOUserAgent and ByteArrayOutputStream.
  4. Create TransformerFactory -> get new Transformer of TransformerFactory with XSLT.
  5. Get xml.transform.Result based fop.defaultHandler and execute transform XML to PDF.
  6. The resulting byte array is output to the ByteArrayInputStream.

How can you speed up the first generation of a PDF? In the logs at the first start, about 10,000 lines generated with the initialization of Apache FOP components.

  • could you please update your question (title), you have to formulate an question to enable others help you – Erdinc Ay Oct 17 '19 at 16:12
  • You can generate a document at startup, so that the first actual request doesn't suffer from this delay. – JB Nizet Oct 18 '19 at 06:40

0 Answers0