Pdf.js: MS Edge - Images render with artifacts

Created on 9 May 2018  路  8Comments  路  Source: mozilla/pdf.js

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:

  • Web browser and its version: Microsoft Edge 41.16299.15.0
  • Operating system and its version: Windows 10 (OS Build: 16299.19) (I'm running this on virtualBox [image taken from here: ], but these issues appear also when Windows is master OS)
  • PDF.js version: 1.9.661
  • Is a browser extension: no

Steps to reproduce the problem:

  1. Open the file with viewer
  2. In about 50% of cases it renderes with artifacts

What is the expected behavior?
Images are rendered correctly
image
image

What went wrong?
Images are rendered with artifacts on them
image
image

Link to a viewer:
https://phantombit.egnyte.com/fl/Ur3Km8eza6#folder-link/
click on file icon
image

Things I checked already:

  • I tried disabling webGL (with disableWebGL flag) to check if it's not related to it - no luck
  • I tried disabling range (with disableRange flag) to check if it's not related to it - no luck
  • I tried reproducing it in your demo, but everything works well there.

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 :-)

1-core 4-edge-specific

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

All 8 comments

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
image

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BadFriend picture BadFriend  路  38Comments

dotnetCarpenter picture dotnetCarpenter  路  39Comments

Vanuan picture Vanuan  路  34Comments

Snuffleupagus picture Snuffleupagus  路  28Comments

snorp picture snorp  路  95Comments