Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PDF Distortion in Chrome Only

654 views
Skip to first unread message

david....@dcu.ie

unread,
Oct 8, 2013, 1:22:28 PM10/8/13
to
Hi,
I've built a web application which uses the PDF.js library for displaying PDF documents (exam papers) inside the browser. When users click a button, a jQuery-UI dialog pops open and the document is displayed within that dialog.

I have this working fine in all browsers (bar my specific version of Safari for windows which won't run the PDF.js sample code even) and the documents open up.

However, in Chrome I'm witnessing distortion in the displayed PDF. You can see an example of this at: http://www.eeng.dcu.ie/~davidm/chrome_pdf.png

Firefox, IE, Opera are displaying this without problem in the dialog. I'm also reasonably certain that documents had rendered correctly in Chrome in dialogs before.

I'm not posting code, as I'm not looking for help debugging. I'm just wondering if anyone experienced with this library might have an idea of what could cause such strange behaviour in the PDF.js output? The sample: http://mozilla.github.io/pdf.js/web/viewer.html is also working fine.

Any help would be greatly appreciated as I'm at a loss how to even start debugging this.

Many thanks in advance,
David

--


*

Email Disclaimer

"This e-mail and any files transmitted with it are confidential and are intended solely for use by the addressee. Any unauthorised dissemination, distribution or copying of this message and any attachments is strictly prohibited. If you have received this e-mail in error, please notify the sender and delete the message. Any views or opinions presented in this e-mail may solely be the views of the author and cannot be relied upon as being those of Dublin City University. E-mail communications such as this cannot be guaranteed to be virus-free, timely, secure or error-free and Dublin City University does not accept liability for any such matters or their consequences. Please consider the environment before printing this e-mail."

Séanadh Ríomhphoist

"Tá an ríomhphost seo agus aon chomhad a sheoltar leis faoi rún agus is lena úsáid ag an seolaí agus sin amháin é. Tá cosc iomlán ar scaipeadh, dháileadh nó chóipeáil neamhúdaraithe ar an teachtaireacht seo agus ar aon cheangaltán atá ag dul leis. Má tá an ríomhphost seo faighte agat trí dhearmad cuir sin in iúl le do thoil don seoltóir agus scrios an teachtaireacht. D’fhéadfadh sé gurb iad tuairimí an údair agus sin amháin atá in aon tuairimí no dearcthaí atá curtha i láthair sa ríomhphost seo agus níor chóir glacadh leo mar thuairimí nó dhearcthaí Ollscoil Chathair Bhaile Átha Cliath. Ní ghlactar leis go bhfuil cumarsáid ríomhphoist den sórt seo saor ó víreas, in am, slán, nó saor ó earráid agus ní ghlacann Ollscoil Chathair Bhaile Átha Cliath le dliteanas in aon chás den sórt sin ná as aon iarmhairt a d’eascródh astu. Cuimhnigh ar an timpeallacht le do thoil sula gcuireann tú an ríomhphost seo i gcló."
*

Andreas Gal

unread,
Oct 8, 2013, 1:30:49 PM10/8/13
to david....@dcu.ie, dev-p...@lists.mozilla.org

This looks familiar. I debugged an issue like this before in Firefox/Gecko. If I remember correctly, we were losing precision during font metrics calculation. Try to isolate a test case for this where you can see font measurements from canvas differ between FF and Chrome and then report that to the Chrome guys.

Andreas
> _______________________________________________
> dev-pdf-js mailing list
> dev-p...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-pdf-js

david....@dcu.ie

unread,
Oct 9, 2013, 9:28:24 AM10/9/13
to
Hi Andreas,
Many thanks for getting back so quickly. I've tried a few other examples of this and have actually determined that the problems are larger problems than simply my code and seem to be to do with Chrome. I originally thought I might have been getting localised clashes with other JS libraries or some weird effects involving jQuery and layering. However, I'm getting similar situations occurring when I just use:

http://mozilla.github.io/pdf.js/web/viewer.html

And select to 'Open' certain types of documents in Chrome:

Here are a few examples of documents that are failing here (including my original source). The other two are just random documents I found searching for 'Sample PDFs'. 60-70% of them were fine - the others failed like these.

http://www.eeng.dcu.ie/~davidm/pdf.js/EE417_Exam_Paper_August-Resit_2014.pdf
http://www.eeng.dcu.ie/~davidm/pdf.js/mailer.pdf
http://www.eeng.dcu.ie/~davidm/pdf.js/Markel.pdf

The browser version I'm using is : Version 30.0.1599.69 m. All of the above PDF documents work with Firefox running at the address above and using 'Open'.

I believe that these problems were not happening until recently, even to the past couple of days, but I'm not sure on this. It appears to be happening with Arial type fonts, but I really don't know (the first document is Arial 12pt)

This is probably as far as my expertise with fonts and PDF extends.

Perhaps you might advise where I should send this, when you refer to the "Chrome guys"? I thought I might find some of them here!

All the best,
David

Note: I also confirmed this running on an alternative laptop running the same version of Chrome (also Windows 7) - just checking it wasn't some weird localised issues with my computer.

Brendan Dahl

unread,
Oct 10, 2013, 1:29:26 PM10/10/13
to david....@dcu.ie, dev-p...@lists.mozilla.org
This could be something wrong with the font loading hack we use on chrome. You could try using just a long timeout at https://github.com/mozilla/pdf.js/blob/master/src/display/font_loader.js#L243 to call the callback.

John Nick

unread,
Oct 29, 2013, 12:26:50 PM10/29/13
to
Hi Andreas,

We're continuing to have the rendering problem in FF v24, but only on a minority of our workstations. On the majority of them the render is correct.

Is there documentation of the debugging you mention from Firefox/Gecko? Would any of it suggest a solution (other than disabling pdf.js) or dependencies that may be the reason behind the issue?

Thanks, John

Brendan Dahl

unread,
Oct 29, 2013, 12:35:28 PM10/29/13
to John Nick, dev-p...@lists.mozilla.org
This thread is about Chrome issues. I'm going to guess that your workstations have either different versions of DirectWrite or they have hardware acceleration turned off. What does about:graphics report on the working and non-working machines.

Brendan
0 new messages