4

I'm using PDFObject to embed a pdf on a webpage. The resulting markup is:

<object data="http://www.example.com/myexample.pdf#view=fitH" 
type="application/pdf" width="100%" height="471px"></object>

I need to run some javascript when the pdf actually finishes loading, but neither the onload, onloadeddata, onreadystatechange events nor the readyState property are realiable for this on all browsers. PDFObject also doesn't seem to provide any cross-browser event for this. How can I know when the PDF finishes loading?

Filipe Correia
  • 5,415
  • 6
  • 32
  • 47

1 Answers1

0

Object tags with PDF documents are in generally not reliable and consistent throughout browsers and devices. See the following answer on alternatives:

Is there a way to remove the Adobe border from an embedded PDF object?

Community
  • 1
  • 1
FlowPaper Team
  • 500
  • 3
  • 7
  • 1
    Thanks for the input, but this doesn't exactly answer my question. FlexPaper is only free for open-source projects, and PDF.JS still has some way to go to support a wide range of PDFs. Trying to provide some consistency across browsers is the main reason why I'm using PDFObject, and it mostly works, despite some caveats. The major one, for me, is detecting when the PDF has finished loading. – Filipe Correia Apr 17 '14 at 12:09
  • @Enrique At the time, no, but this was over 7 years ago. There's a chance things may have evolved by now – Filipe Correia Jun 04 '21 at 16:38