How to solve the difference between the PDF exported by Linux and win



  •     //Version Information
        "jsreport": "^2.11.0",
        "jsreport-chrome-pdf": "=1.9.0",
        "compare-pdf": "^1.1.8",
    

    As shown in the figure below, the PDF exported on different platforms will have a little difference, which will cause the PDF test to fail.
    Is there a good solution to this problem, thanks.

    0_1678955316407_upload-0e9ad3cd-0b1e-496d-82d0-3b5036f7d037



  • And what is the difference?
    There is likely nothing we can do, we can't influence how chrome is using native OS APIs.



  • When using compare-pdf to compare two PDFs, the differences will be highlighted, such as the green part in the figure.

    The position of the fonts generated by win and linux is a little bit different, which leads to this problem.



  • Did you try using a webfont instead of fonts from OS?



  • This is the html I copied under temp before merging to PDF. From here you can see that I used my own font, so the font of win and linux should be the same.
    0_1679389703476_upload-4e020cc5-07d4-4ab9-b408-7ae3b8106cf3



  • Do you need to use the compare-pdf just because of some unit tests? Perhaps you find a better way of testing.



  • ok, thanks for your reply.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.