Skip to content
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

php unit testing #8

Closed
murraycollingwood opened this issue May 10, 2023 · 2 comments
Closed

php unit testing #8

murraycollingwood opened this issue May 10, 2023 · 2 comments
Labels
question Further information is requested

Comments

@murraycollingwood
Copy link

Hello

I'm trying to implement some php unit testing around my PDF generation.
I can easily check the creation of the PDF document, but if I want to ensure it contains the text I'm looking for, formatted in a similar manner, I'm having trouble.

I found this article (https://stackoverflow.com/questions/32489513/software-testing-a-pdf-is-created-correctly) which suggested generating the PDF and comparing it to a previously generated PDF, which I tried, but it didn't work. Even though both contained exactly the same content the strings were never the same.

Do you have any suggestions how I might be able to ensure my PDF contains the correct content?

@endelwar
Copy link
Member

Hi!
Reproducible PDF as been introduced in WeasyPrint 55.0b1 and fixed in 56.0 (see Kozea/WeasyPrint#1666).

in a comment to issue #1553 is suggested to add a meta tag to html:

<meta name="dcterms.created" content="2023-05-10">

Keeping the content fixed and setting a system ENV to a fixed value (SOURCE_DATE_EPOCH=0) should be enough to create reproducible pdf.

Let me know if this solves your problem!

@endelwar endelwar added the question Further information is requested label May 10, 2023
@endelwar
Copy link
Member

Was your problem solved with my suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants