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

Fix links break on addPage with different size #2943

Merged
merged 6 commits into from
Oct 7, 2020

Conversation

MarceloZapatta
Copy link
Contributor

This PR will fix the #2801.
Writes the links with calculated final bounds on link function.

@HackbrettXXX
Copy link
Collaborator

Thanks. Could you also add a unit test, please? https://github.com/MrRio/jsPDF/blob/master/CONTRIBUTING.md#building-and-testing-jspdf

@MarceloZapatta
Copy link
Contributor Author

@HackbrettXXX I dont have too much knowledge in tests, but i tried to write one. I created a reference file to compare when the link is written wrong, but it only passes on Chrome / Firefox.
But manually testing on sauselabs on Internet Explorer it works has is expected. So if I get the file result of IE, it fails in reverse way, passes on IE but fails in Chrome / Firefox.

Looks like the fails is not related with the previous issue.

Not sure how to write this test to compare the PDF only for the position of the link, can you help me?

@HackbrettXXX
Copy link
Collaborator

Thanks for adding a test case. The issue seems to be small floating point differences. In order to fix this you can add the floatPrecision: 2 option to the jsPDF constructor.

@MarceloZapatta
Copy link
Contributor Author

@HackbrettXXX Thanks for the tip! It worked like a charm.

Fixed the unit test, also moved into annotations.spec.js that make more sense.

@HackbrettXXX HackbrettXXX merged commit c964480 into parallax:master Oct 7, 2020
@HackbrettXXX
Copy link
Collaborator

Thanks :)

This was referenced Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants