manuelbl / SwissQRBill

Java library for Swiss QR bill payment slips (aka QR-Rechnung)
https://www.codecrete.net/qrbill
MIT License
156 stars 37 forks source link

NoSuchMethodError - PDPageContentStream.setNonStrokingColor(FFF) #75

Closed Brunschi closed 2 years ago

Brunschi commented 2 years ago

I tried to get the example AppendToPDF but I get the following error:

Exception in thread "main" java.lang.NoSuchMethodError: org.apache.pdfbox.pdmodel.PDPageContentStream.setNonStrokingColor(FFF)V at net.codecrete.qrbill.canvas.PDFCanvas.fillPath(PDFCanvas.java:306) at net.codecrete.qrbill.generator.QRCode.draw(QRCode.java:115) at net.codecrete.qrbill.generator.QRBill.validateAndGenerate(QRBill.java:210) at net.codecrete.qrbill.generator.QRBill.draw(QRBill.java:165) at net.codecrete.qrbill.examples.AppendToPDF.main(AppendToPDF.java:67)

It look like the following command is the problem: contentStream.setNonStrokingColor(r / 255f, g / 255f, b / 255f); [compiler-result: this.contentStream.setNonStrokingColor((float)r / 255.0F, (float)g / 255.0F, (float)b / 255.0F); ]

Is there a problem with the PDFBox-Version? but could not find a PDFBox version with the used method signature.

The environment is:

Thanks for help and even more thank you for your provided project. Urs Brunschwiler

manuelbl commented 2 years ago

The example AppendToPDF uses the latest QR Bill Generator library (version 3.0.5) and version 2.0.26 of PDFBox. This is the compatible version, and it is explicitly specified by the QR Bill Generator library.

Aren't you using Maven or Gradle? How did you set up your Java project?

If you download the example project and run ./gradlew clean execute (or gradle.bat clean execute on Windows) from the project directory, it will compile and run.

Brunschi commented 2 years ago

Thanks for help and info to package-versions. It wasn't obvious to me that PDFBox made a feature update here. For the moment the downloaded example had proper worked, together with the specified PDFBox version.

I'm using Maven and Intellij.

Thanks.