Good Morning Rolf,

please double check your dependencies: I think it's FOP instead of FOP-
CORE.
For me, the following dependencies work with Java21 and I get nice PDFs
out:

// PDF Output
implementation ('org.apache.xmlgraphics:fop:+') {
    exclude group: 'xalan', module: 'xalan'
}
implementation ('org.apache.xmlgraphics:batik-codec:+') {
    exclude group: 'xalan', module: 'xalan'
}

Viel Glueck!
Andreas

On Fri, 2024-09-06 at 05:47 +0200, Rolf Schumacher wrote:
>  
> Is there some help about fop?
>  
> -------- Forwarded Message -------- Subject: Re: How to use fop with
> Java 21 
> Date: Thu, 5 Sep 2024 12:26:09 +0200 
> From: Csaba Nánai <szea...@gmail.com> 
> To: Rolf Schumacher <r...@august.de> 
> 
> 
> 
> Hi, Rolf 
> 
> 
> 
> Sorry, but i'm not at home in JPMS and Java 21 capabilities.
> 
> Please send this mail to the list for community help.
> 
> 
> 
> 
> Best luck
> 
> 
> 
> Rolf Schumacher <r...@august.de> ezt írta (időpont: 2024. szept. 5.,
> Cs, 8:11):
> 
> > 
> > 
> > Thank you for responding Csaba.
> > 
> > Years ago i did me a utility module, amoung others hosting
> > operations to help with xslt and fop. fop 2.8 was the latest
> > version that worked. Every year I am trying to upgrade to 2.9,
> > hoping that fop can be used seemlessly with JPMS, now Java 21. I
> > did a new trial these days and failed again.
> > 
> > The pom.xml of the utility module draws the dependencies
> > 
> > 
> > <dependency>
> > <groupId>org.apache.xmlgraphics</groupId>
> > <artifactId>fop-core</artifactId>
> > <version>2.9</version>
> > </dependency>
> > <dependency>
> > <groupId>org.apache.xmlgraphics</groupId>
> > <artifactId>xmlgraphics-
> > commons</artifactId>
> > <version>2.9</version>
> > </dependency>
> > 
> > 
> > The application which depends ot the util module copies all
> > dependencies to a "lib" folder:
> > 
> > 
> > <plugin>
> > <groupId>org.apache.maven.plugins<
> > /groupId>
> > <artifactId>maven-dependency-
> > plugin</artifactId>
> > <version>3.8.0</version>
> > <executions>
> > <execution>
> > <id>copy-
> > dependencies-to-lib</id>
> > <phase>package</ph
> > ase>
> > <goals>
> > <goal>copy
> > -dependencies</goal>
> > </goals>
> > <configuration>
> > <outputDir
> > ectory>target/lib</outputDirectory>
> > <overWrite
> > Releases>false</overWriteReleases>
> > <overWrite
> > Snapshots>true</overWriteSnapshots>
> > </configuration>
> > </execution>
> > </executions>
> > </plugin>
> > 
> > 
> > 
> > If I run the application by 
> > 
> > 
> > 
> > 
> > java -p fctr-0.0.1-SNAPSHOT.jar:lib -m
> > eu.ngong.fctr/eu.ngong.fctr.App [1] RoS fctr
> > 
> > 
> > 
> > 
> > I get the error
> > 
> > 
> > 
> > 
> > Error occurred during initialization of boot layer
> > java.lang.module.ResolutionException: Modules fop.core and fop.util
> > export package org.apache.fop.util.text to module qdox
> > 
> > 
> > 
> > 
> > I spend days to manually sort out all the jar files in "lib" folder
> > to warrant that each module can be found only ones. That work
> > finally became successful and the application starts, but fop is
> > missing some classes. If I put the jar files back hosting those
> > classes (lots of work!) I get again the error of doubled packages.
> > 
> > 
> > 
> > 
> > It would be too much to reduce the application to just isolate the
> > problem. Therefore I am looking for an example with this
> > properties:
> > - Java 21
> > 
> > - maven
> > 
> > - fop 2.9
> > 
> > - generating a PDF from an xslfo file.
> > 
> > to try to build up from there and find my problem. Or: I just wait
> > another year, stick to non-JPMS fop 2.8.
> > 
> > 
> > 
> > 
> > BR
> > 
> > Rolf
> > 
> > p.s. ChatGPT does not find such an example.
> > 
> > 
> > 
> > 
> > On 9/4/24 12:34, Csaba Nánai wrote:
> > 
> > > 
> > > Hi Rolf, 
> > > 
> > > 
> > > 
> > > Did you have a compiling issue or runtime error?
> > > 
> > > 
> > > 
> > > 
> > > Please let us know more!
> > > 
> > > Please send error messages and stack trace, and a minimal
> > > reproducible example!
> > > 
> > > 
> > > 
> > > 
> > > Best regards, Csaba
> > > 
> > > 
> > > 
> > > Rolf Schumacher <r...@august.de> ezt írta (időpont: 2024. szept.
> > > 3., K, 18:40):
> > > 
> > > > 
> > > > Dear fop specialists, 
> > > > 
> > > > some time ago I used to use fop something like shown below (I
> > > > hope the formatting stays constant).
> > > > 
> > > > Now I was trying to do so with maven, Java-21 and fop 2.9 and
> > > > failed.
> > > > 
> > > > Is there an example program, e.g. on github, how to use fop
> > > > 2.9, including the pom.xml and the module-info.java?
> > > > 
> > > > =====
> > > > 
> > > > 
> > > > FopFactoryBuilder builder = new
> > > > FopFactoryBuilder(basePath.toUri())
> > > > .setPageHeight("297mm")
> > > > .setPageWidth("210mm");
> > > > FopFactory fopFactory = builder.build();
> > > > out = new
> > > > BufferedOutputStream(Files.newOutputStream(r));
> > > > Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,
> > > > out);
> > > > Transformer transformer =
> > > > TransformerFactory.newInstance().newTransformer();
> > > > Source src = new StreamSource(fo.toFile());
> > > > Result res = new SAXResult(fop.getDefaultHandler());
> > > > transformer.transform(src, res);
> > > > out.close();
> > > > 
> > > > 
> > > > =====
> > > > mit freundlichen Grüße, Best Regards
> > > > 
> > > > Rolf
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > mit freundlichen Grüße, Best Regards
> > 
> > Rolf
> > 
> > 
> > 
> 
>  


[1] eu.ngong.fctr.App http://eu.ngong.fctr.app/

Reply via email to