ZUGFeRD / mustangproject

Open Source Java e-Invoicing library, validator and tool (Factur-X/ZUGFeRD, UNCEFACT/CII XRechnung)
http://www.mustangproject.org
Apache License 2.0
168 stars 99 forks source link

CLI: action combine: --ignorefileextension to ignore PDF/A input file errors dosen't work #392

Closed joergenp closed 1 week ago

joergenp commented 2 weeks ago

when combining a pdf (created as PDF/A-1b with Libre Office) with a xml the CLI throws ERROR ROOT - File is not a valid PDF/A-1 input file independent of option --ignorefileextension.

By looking at the source I can see that .load(pdfName) ist called before .ignorePDFAErrors() (code line 715-728):

                ze = new ZUGFeRDExporterFromPDFA().load(pdfName);

                    ze.setProducer("Mustang-cli")
                    .setZUGFeRDVersion(zfIntVersion)
                    .setCreator(System.getProperty("user.name")).setProfile(zfConformanceLevelProfile);
                if (ignoreInputErrors) {
                    ((ZUGFeRDExporterFromA1) ze).ignorePDFAErrors();
                }
            }
            for (FileAttachment attachment : attachments) {
                ((ZUGFeRDExporterFromA3) ze).attachFile(attachment.getFilename(), attachment.getData(), attachment.getMimetype(), attachment.getRelation());
            }

//          ze = ze.load(pdfName);

Seems this was introduced on #341

jstaerk commented 1 week ago

I added a test for the functionality itself in [d22a8a0] , unfortunately I cant test end-to-end yet due to a Exception in thread "main" java.lang.NoClassDefFoundError: jakarta/activation/DataSource... I hope I can fix that soon