Recently we integrated for our project Cocoon 2.1.4 with DAY Communqiué 3.5.4 (a CMS) and use it together with FOP 0.20.5 for PDF generation.
The problem with the existing FOP integration in cocoon is the lack of properly Excalibur source resolving support. Without this (excellent) feature it is not possible to embed images in PDFs from custom source implementations (i.e. a communiqué contentbus source implementation in our case). For some reasons it was not possible for us to use the common workaround and include the images via a HTTP request. To solve this problem we patched the FOP Sources (Class FopImageFactory) and implemented in a simple way a support for Excalibur Source Resolving in Cocoon (extended file attached, added sections are clearly marked with comments). Because of the existing FOP 0.20.5 implementation we have to use some static methods to initialize FOP with the current source resolver from cocoon (this is the only drawback of the solution). The implementation checks first to resolve a image URL with the source resolver, and has a fallback to the default fop implementation if this fails. To initialize FOP with the current cocoon source resolver it is possible to write a simple cocoon action and add it to the pdf generation pipeline (sample attached - 2nd file). Through not tested in all details yet this solutions works very well for us (and should offer a better performance than the workaround with the http requests). I cross-post this message to fop-dev and cocoon-dev. To the FOP developers: Any chance to integrate Excalibur Source Resolving support in the main FOP codebase? If this would be the case we could patch the cocoon pdf serializer too to hand over the source resolver and get lack of the additional action. Stefan
FopImageFactory.java
Description: FopImageFactory.java
CqInitializeFopImageFactoryAction.java
Description: CqInitializeFopImageFactoryAction.java