Hi,
I’m trying to highlight text calling PDFDoc.addHighlights and passing xml file with pdf highlights. For some reason some highlights are not shown. As far as I saw - usually it’s first n highlights are missed. For different documents that “n” number is different.
Is it trial version limitation or I do somth. wrong?
Could you please provide us with the code you are using, along with the PDF and the highlight file so that we can try to reproduce the issue on our end?
Thank you in advance for the additional information.
I can’t upload files here, it says “new user can’t upload files”.
I shared it via wetransfer.com - https://we.tl/t-d9lZ8oHm09
Please let me know if this share doesn’t work for you.
For this example WebViewer doesn’t show highlights on the first page (pg=0), but shows all other ones.
BTW, I also tried same example in C# and it works well for all pages.
Could you please provide two screenshots, one showing what you see in WebViewer, and another screenshot clearly indicating what you expected to see. Please also provide the Highlights XML used for the screenshots.
Could you please provide two screenshots, one showing what you see in WebViewer, and another screenshot clearly indicating what you expected to see. Please also provide the Highlights XML used for the screenshots.
You are trying to add the highlights at the same time when loading the document. This will cause some race conditions (page 1 was not loaded when you add highlights), and I guess that’s why the highlight is not working on page 1. And this way may also cause other issues if you use other PDFs.
If you want to have this to work, you may need to use requirePage() to make sure that page are loaded before adding highlights. See: PDFTron WebViewer Class: PDFDoc for more details.