-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistency of generated Zugferd PDF files #201
Comments
& do we really need the |
Hi! Unfortunately, I don't understand the question because I can't see the problem you seem to have with it either. How can I help you? The implementation works. So I don't know what's bothering you? You may be able to adapt your unit tests so that you really only test the critical areas. In a PDF document, the random bytes after the PDF version are not a mandatory technical requirement, but a common practice to support certain compatibility and security aspects. And you are right: Neither CreateDate nor ModifyDate are defined as mandatory fields in the PDF standard. They are part of the optional information dictionary, which can contain metadata such as title, author, keywords, etc. However, I will not remove this information as it is useful for the recipient of such an e-invoice for user and archiving purposes. Kind regards? |
Well, automated testing becomes difficult... Non-deterministic PDF generation significantly complicates testing. This kinda forces you to:
It makes testing more complex and time consuming, especially if you treat this as a blackbox test. Simple assertions like "given these inputs, the output should exactly match this reference file" become impossible.
Ah, but no reason to have those be random?
Maybe make those optional fields optional for a user who's consuming this library too? |
+1 for deterministic Testing. In the near future i will build the same as disservin does here for us. We absolutly need to ensure the viewable PDF is the same as the XML. |
Hi, but I can't change an existing implementation just so that your unit tests go through. Kind regards |
This has like no breaking changes though ? The random bytes are random and aren't used for anything. It makes no difference if they are not random? |
Unfortunately, I find it a little disrespectful the way you are hammering me here. I develop and maintain the library in my spare time - and I love doing it. Perhaps a small thank you would have been appropriate at the beginning. I want to see what I can do for you. At the moment I'm very tied up with my “real” job. Kind regards |
I wasn't trying to hammer you into anything - I simply wanted to understand the technical reasoning for these things and if you were open for changes. As someone who maintains open source software myself, I appreciate your work on this library. I'd be happy to implement this myself if you'll approve the general direction of these changes. |
Hi @Disservin, Of course I am open to changes - no question. But because this library is already quite widespread and widely used, I have to make sure that I don't make any changes that I'll regret at some point. As I said: I want to see what I can do for you. If you like, you are very welcome to submit a PR. Kind regards |
Hi @Disservin, I have created a PR #203 and tried to meet your requirements. I ask you for a review and feedback. Thank you very much and have a nice weekend. |
This looks good from a consistency standpoint (which this issue was about) I think, thank you.
|
Hi @Disservin, Okay. Thanks for the feedback. I would then transfer this to the productive branch and am pleased to have satisfied you with it.
I don't think so. This metadata has made sense for decades and therefore has a right to exist... ;-) Kind regards |
Hi,
I've noticed two features in the zugferd PDF creation that make it difficult to achieve deterministic output:
Random bits are being added here: https://github.com/horstoeko/zugferd/blob/master/src/ZugferdPdfWriter.php#L97
What's the purpose of this randomization?
Are the ModifyDate/CreationDate fields strictly required by the specification?
Context: I'm trying to write unit tests where input files A & B should consistently produce the same output PDF C. The random bits and timestamps make this challenging. While timestamps could potentially be handled by mocking system time, this feels like a hacky solution.
The text was updated successfully, but these errors were encountered: