Some time ago we started using PDF.js in Egnyte. It works very well, but just now we have some problems with pdf containg images on MS Edge. They render with artifacts sometime.
I'm using following viewer flags:
disableStream = true;
disableAutoFetch = true;
But changing them to false does not seem to help.
PDF.js reports no errors and no errors are thrown in console.
All resources (source pdf, screenshots, har files) can be found here: https://phantombit.egnyte.com/fl/Ur3Km8eza6
Configuration:
Steps to reproduce the problem:
What is the expected behavior?
Images are rendered correctly
What went wrong?
Images are rendered with artifacts on them
Link to a viewer:
https://phantombit.egnyte.com/fl/Ur3Km8eza6#folder-link/
click on file icon
Things I checked already:
Generally I suspect that this may be related with network, and sending this file in chunks. The random nature of this bug leads me to this conclusion. But as you have chance to see in attached .har files - there does not seem to be anything wrong with requests. None of them is empty, there are no errors. I'm kinda in dead end here at this point.
Any kind of help/advice is welcome :-)
Reproduced:
PDFJS: 2.0.502
Microsoft Edge 42.17134.1.0
Microsoft EdgeHTML 17.17134
Options:
disableStream = true;
disableAutoFetch = true;
give no difference.
Library is not stable in Edge - it changes the result after page refresh, sometimes getDocument cannot open PDF at all, sometimes page render freezes forever and there are not errors/warnings in the console. Sometimes there are such warnings:
Warning: Ignoring invalid character "105" in hex string
Warning: Ignoring invalid character "107" in hex string
Warning: Ignoring invalid character "22" in hex string
Found a solution:
window.PDFJSgetDocumentTask = getDocument('test.pdf');
Save reference for getDocument task in an achievable from the global space variable. It seems the task destroys in other case, because there are not other references on it.
But if you disable the browser cache the issue appears again.
@iberezansky Thank you, I'll check and let you know if it helped in my case too.
EDIT
Unfortunately - I'm still getting these artifacts
We are also getting the same problem, a PDF containing an image will occasionally render with artifacts/offsetted positioning/wrong colors.
We are also getting the same problem, a PDF containing an image will occasionally render with artifacts/offsetted positioning/wrong colors. but this thing only happens in MS EDGE. Its working fine in chrome, chromium, firefox.
Edge version :
Microsoft Edge 42.17134.10
Microsoft EdgeHTML 17.17134
@tiriana any workaround available for this issue? between .... 10 out of 1, I am getting correct PDF
@ko06 Unfortunately not, we don't have any workaround. TBH - I don't have a clue what can be the cause. I'd bet on the worker, but that's just my guess.
Closing IE11/Edge (non-Chromium-based) issues in response to #11211. Please note that, as outlined in https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support, only bugs which completely prevent the library and/or the default viewer from running will be accepted.
Most helpful comment
Reproduced:
PDFJS: 2.0.502
Microsoft Edge 42.17134.1.0
Microsoft EdgeHTML 17.17134
Options:
disableStream = true; disableAutoFetch = true;
give no difference.
Library is not stable in Edge - it changes the result after page refresh, sometimes getDocument cannot open PDF at all, sometimes page render freezes forever and there are not errors/warnings in the console. Sometimes there are such warnings:
Warning: Ignoring invalid character "105" in hex string
Warning: Ignoring invalid character "107" in hex string
Warning: Ignoring invalid character "22" in hex string