Easiest way to add ZUGFeRD XML to PDF-A/1

956 views
Skip to first unread message

al...@bobbie.de

unread,
Jan 6, 2019, 8:47:48 PM1/6/19
to ZUGFeRD
Hi,

I'm working on a ZUGFeRD Magento (1.9 unfortunately for now) integration for bobbie.de and hopefully later the rest of the world.. I managed to modify/use pyrexx ZUGFeRD php classes (https://github.com/Pyrexx/zugferd-php) to generate the XML, and to tweak tcpdf (https://tcpdf.org/) + foomans PDF Customizer (https://store.fooman.co.nz/magento-extension-pdf-customiser.html) to give me a valid PDF-A/1. 
Now I "just" need to switch that to PDF-A/3 and include the XML with proper ZUGFeRD headers. What do you think is the best approach here.
I realise Mustang can do that, but as I see it is meant to do much more, i.e. also generate the XML (which I do in PHP, because that's where magento lives). Also, mustang currently only has the command line -c option, which works totally fine, but requires input.
So either I modify mustang to have full command line support for -c (which likely is not hard, but opens up yet another package to tweak, and that in yet another language), or I use a different tool (ideas welcome), or throw some goodies/cash at you guys to add the switches?
Anything I missed?

regards
Alex

jochen...@gmail.com

unread,
Jan 8, 2019, 2:28:46 AM1/8/19
to ZUGFeRD
Hi,
 
Now I "just" need to switch that to PDF-A/3 and include the XML with proper ZUGFeRD headers. What do you think is the best approach here.

You can relabel it, since A/3 is backward compatible to A/1 all you have to do is have it claim it is a A/3, which it is. 

The issue is that afterwards you do not only have to embed the file but also the XMP XMPSchemaPDFAExtensions, e.g. stating that the DocumentType is invoice.
 
I realise Mustang can do that, but as I see it is meant to do much more, i.e. also generate the XML (which I do in PHP, because that's where magento lives). Also, mustang currently only has the command line -c option, which works totally fine, but requires input.

Long story, after Andreas created a PHP-based online converter (using "expect" to simulate input), a gentle push and a long wait Indigo744 finally and thankfully contributed https://github.com/ZUGFeRD/mustangproject/commit/329bfd489d9446dc58a4899acb3850acd95f7c1d, so you should be able to use --combine   
--source <filename>
--source-xml <filename>
--out <filename>
--zugferd-version <1|2>
--zugferd-profile <...>
 
So either I modify mustang to have full command line support for -c (which likely is not hard, but opens up yet another package to tweak, and that in yet another language), or I use a different tool (ideas welcome), or throw some goodies/cash at you guys to add the switches?
Anything I missed?
 
Er, yes. Andreas'  online converter is proprietary, as is FerdMCs online version of ZUV. In 2018 I tried to persuade Andreas to collaborate on a open source web tool. Unfortunately my frontend developer is leaving for a semester abroad so from my side this is stopped. But if there were a contributing driver behind that it could be continued. Maybe you want to contribute code e.g. in some API-ish direction?

kind regards

Jochen 
Mustangproject Chief ZUGFeRD Amatuer

Alexander Gran

unread,
Jan 9, 2019, 7:27:34 AM1/9/19
to ZUGFeRD

Hi Jochen,

 

> The issue is that afterwards you do not only have to embed the file but also the XMP XMPSchemaPDFAExtensions, e.g. stating that the DocumentType is invoice.

 

That all sounds like deep magic to me, glad that mustang handles that 😉       

 

> Long story, after Andreas created a PHP-based online converter (using "expect" to simulate input), a gentle push and a long wait Indigo744 finally and thankfully
> contributed 
https://github.com/ZUGFeRD/mustangproject/commit/329bfd489d9446dc58a4899acb3850acd95f7c1d, so you should be able to use --combine   

>            --source <filename>

>            --source-xml <filename>

>            --out <filename>

>            --zugferd-version <1|2>

>            --zugferd-profile <...>

 

Just build current snapshot (ignoring has some failing test), that seems to work just fine!

 

> Er, yes. Andreas'  online converter is proprietary, as is FerdMCs online version of ZUV. In 2018 I tried to persuade Andreas to collaborate on a open source web
> tool.
Unfortunately my frontend developer is leaving for a semester abroad so from my side this is stopped. But if there were a contributing driver behind that it
> could be continued.
Maybe you want to contribute code e.g. in some API-ish direction?

 

I’ll certainly publish a howto, I guess with code included. Not so sure about an online converter, is mustang/pdfbox considered safe for untrusted data input? I guess it is not developed with that in mind?

 

Regards

Alex

Reply all
Reply to author
Forward
0 new messages