HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › PD4ML Tips & Tricks › Automated testing – Random values
- This topic has 8 replies, 2 voices, and was last updated Nov 27, 2013
09:12:51 byAnonymous.
-
AuthorPosts
-
November 25, 2013 at 14:02#26892
Hello,
We would like to do byte-to-byte comparison of expected and generated PDF files in our automated testing suite.
As explained in the official documentation of PD4ML, we have overridden the PD4ML_DOCUMENT_DATE attribute : http://pd4ml.com/api/org/zefer/pd4ml/PD4Constants.html#PD4ML_DOCUMENT_DATE
However, we have found other attributes that absolutely need to be overridden to make our tests pass.
1) At the bottom of the PDF file, the “/ID [GENERATED_NUMBER]” metadata is generated randomly.
Please advise how we can override this value with a fixed user provided value.
2) The order of the embedded object declaration (/XObject metadata) is random.
Sometimes we have :
/XObject <<<br /> /img1 4 0 R<br /> /img2 5 0 R<br /> /img0 3 0 R<br /> /img3 2 0 R<br /> >><br />Other times :
<br /> /XObject <<<br /> /img3 2 0 R<br /> /img1 4 0 R<br /> /img2 5 0 R<br /> /img0 3 0 R<br /> >>And so on.
We use Velocity with CSS attributes to embed images so the order of inclusion should not be random.
Please advise how we can fix the order of the /img elements.
Thanks
November 25, 2013 at 15:09#29440Some time ago we specially addressed automatic testing issues.
A JVM parameter like -Dpd4ml.document.id=0123456789abcdef (16 chars) should help to resolve /ID [GENERATED_NUMBER] issue.
Also the image references are sorted by original image paths. Can it be that the paths differ from test to test?
November 25, 2013 at 15:45#29441Thanks for your answer.
Setting the system property solved the random ID issue.
Concerning image paths, they are defined in a static CSS file.
This CSS file is located in a fixed directory. The images also.
I would have looked at the source code in debug to understand the issue but I do not have access to the source code.
Could you think of anything else that would randomize this list?
Thanks for your help.
November 25, 2013 at 15:57#29442Obviously it would make sense to sort the image references by image IDs. I’ve just corrected the code in the development build, and it seems XObject dictionary appears sorted now.
November 25, 2013 at 17:25#29443Would you know in which version and/or at which time this fix would be released?
November 25, 2013 at 17:46#29444We could send you an interim development build. Contact support pd4ml com. Currently the image reference sorting is the only difference from v385fx3
November 26, 2013 at 10:27#29445Would you have an idea when this would be released? 1 month, 6 months, a year?
November 27, 2013 at 08:05November 27, 2013 at 09:12#29447Awesome thanks.
-
AuthorPosts
The forum ‘PD4ML Tips & Tricks’ is closed to new topics and replies.
