Bug 703862 - Feature request: adapt lib/zugferd.ps to newer versions of the ZUGFeRD standard
Summary: Feature request: adapt lib/zugferd.ps to newer versions of the ZUGFeRD standard
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: 9.54.0
Hardware: PC Windows 10
: P4 enhancement
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-19 04:54 UTC by Adrian Devries
Modified: 2022-04-28 07:08 UTC (History)
1 user (show)

See Also:
Customer:
Word Size: ---


Attachments
Enhanced version of lib/zugferd.ps (17.00 KB, application/postscript)
2021-05-19 04:54 UTC, Adrian Devries
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Devries 2021-05-19 04:54:49 UTC
Created attachment 20994 [details]
Enhanced version of lib/zugferd.ps

The ZUGFeRD standard has grown over time (cf. https://www.ferd-net.de/standards/zugferd-versionsarchiv/index.html), the newest version is 2.1.1. The current script "lib/zugferd.ps" is based on a pre-release version of the standard, and there is a bug in that script (cf. https://bugs.ghostscript.com/show_bug.cgi?id=703861). Find attached an enhanced version of the script supporting all known versions of the ZUGFeRD standard. Remaining tasks have been marked with "TODO".
Comment 1 Ken Sharp 2021-08-18 13:03:53 UTC
Hi Adrian,

Firstly let me say thanks for the submission, much appreciated!


(In reply to Adrian Devries from comment #0)

> The ZUGFeRD standard has grown over time (cf.
> https://www.ferd-net.de/standards/zugferd-versionsarchiv/index.html), the
> newest version is 2.1.1.

Obviously our focus is printing so we aren't tracking the ZUGFeRD/Factur-X standard. I'm afraid I have no way to know when a new/updated standard is released.


> The current script "lib/zugferd.ps" is based on a
> pre-release version of the standard, and there is a bug in that script (cf.
> https://bugs.ghostscript.com/show_bug.cgi?id=703861).

> Find attached an
> enhanced version of the script supporting all known versions of the ZUGFeRD
> standard. Remaining tasks have been marked with "TODO".

Rather than fix the existing program I'd prefer to adopt your work, but I think I need a Contributor License Agreement because it is a significant enough change that we need copyright assignment. Its much more than a trivial update to the original program.

Could I ask you to fill out this PDF https://www.ghostscript.com/images/Artifex%20Contributor%20License%20Agreement%202017.pdf

please ?

Artifex needs copyright assignment or we can't distribute the code on a commercial basis. We will, of course, be making it available open-source as well.

Once I have that I will push the improved program to our Git repository. You will be recorded as the author of the commit, so can I ask how you would like to be identified ?
Comment 2 Adrian Devries 2021-08-19 08:11:15 UTC
Hi Ken,

I sent a signed copy of the Contributor License Agreement to you by facsimile and by e-mail. Please, take the name of my bugzilla account to identify me.

Thanks in advance!
Comment 3 Ken Sharp 2021-08-19 08:22:49 UTC
(In reply to Adrian Devries from comment #2)
> Hi Ken,
> 
> I sent a signed copy of the Contributor License Agreement to you by
> facsimile and by e-mail. Please, take the name of my bugzilla account to
> identify me.

Absolutely brilliant, many thanks for that, and for doing all the work. As soon as I hear back from the office I will get it committed. Just in time for the next release too!

Leaving this open until I actually make the commit so I don't forget.
Comment 4 Adrian Devries 2021-08-19 09:48:48 UTC
Hi Ken,

please, note that there is another issue that exists still in the enhanced version of lib/zugferd.ps. Line 177 of the original file (line 442 of the enhanced file) contains the following. "/ModDate    (D:20130121081433+01’00’)", i.e., hours and minutes are followed by char 0x92 instead of char 0x27. The text should be written as follows: "/ModDate    (D:20130121081433+01'00')".
Comment 5 Ken Sharp 2021-08-19 10:15:33 UTC
(In reply to Adrian Devries from comment #4)
> Hi Ken,
> 
> please, note that there is another issue that exists still in the enhanced
> version of lib/zugferd.ps. Line 177 of the original file (line 442 of the
> enhanced file) contains the following. "/ModDate   
> (D:20130121081433+01’00’)", i.e., hours and minutes are followed by char
> 0x92 instead of char 0x27. The text should be written as follows: "/ModDate 
> (D:20130121081433+01'00')".

Hmm nobody has ever mentioned that before! That'll be in pdfwrite itself, I'll go and look, thanks.
Comment 6 Ken Sharp 2021-08-19 10:24:03 UTC
(In reply to Adrian Devries from comment #4)
> Hi Ken,
> 
> please, note that there is another issue that exists still in the enhanced
> version of lib/zugferd.ps. Line 177 of the original file (line 442 of the
> enhanced file) contains the following. "/ModDate   
> (D:20130121081433+01’00’)", i.e., hours and minutes are followed by char
> 0x92 instead of char 0x27. The text should be written as follows: "/ModDate 
> (D:20130121081433+01'00')".

D'oh, I can't read, its the zugferd.ps file. Right, I will fix that before I commit. I suspect an overly helpful editor....
Comment 7 Ken Sharp 2021-08-20 07:25:22 UTC
Update committed here:

https://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=0a6b6cfaa7740cbef31644afbd0085b0eca38c43

Thanks very much for the contribution!

I'm just writing an email to a colleague to update the relevant page on our website, but that won't be done before Monday.
Comment 8 Oliver Rettig 2022-04-27 20:01:16 UTC
For those who want to leverage the ZUGFeRD Ghostscript feature with the German IT company DATEV providing services to tax consultants: Whereas the generated PDF actually validates correctly according to the 2.1.1 standard, DATEV is not able to recognize the attached XML. This is due to the File Specification Dictionary that is defined as

/Type /FileSpec

whereas the standard is asking for

/Type /Filespec

DATEV is picky on this (and perhaps others as well). If you change the lib/zugferd.ps accordingly, all information is interpreted appropriately.

BTW, in the meantime version 2.2 of the standard got released. But as long as this is not made mandatory, 2.1.1 is perfectly fine.

I highly appreciate all the efforts you had put into this! It does provide great help with introducing electronic invoices with established business processes. Thanks so much!
Comment 9 Ken Sharp 2022-04-28 07:08:02 UTC
(In reply to Oliver Rettig from comment #8)
 
> /Type /FileSpec
> 
> whereas the standard is asking for
> 
> /Type /Filespec

The PDF 1.7 spec says (Section 3.10.2, File Specification Dictionaries) that it should indeed have a Type of Filespec (the PDF specification has no consistency in use of camel case sadly).

I've pushed this commit d1a0339f45c355aa04b3168de3a8d7a4e6d63e34 to fix that.

Thanks for reporting it!