pipwerks / PDFObject

A lightweight JavaScript utility for dynamically embedding PDFs in HTML documents.
http://pdfobject.com/
Other
2.39k stars 986 forks source link

Adding a scroll event on the Pdf object #58

Closed JSalaat closed 8 years ago

JSalaat commented 8 years ago

I am trying to add a scroll event to the PDF object I've created with PDFObject. I want user to scroll at least once before submitting the form.

I've tried javascript onscroll and jQuery .scroll() but its no use.

$('#pdfRenderer')[0].scrollTop alway return 0 in any position niether the event is working.

Is there a way to achieve this using PDFObject.

Thanks.

pipwerks commented 8 years ago

Unfortunately this is not possible. The PDF is usually not a DOM element, it's rendered by PDF reader software. Every browser has its own mechanism for rendering PDFs, there is no standard. In some cases, the PDF might be rendered by PDF.js; in those situations you might be able to detect scrolling. But Adobe Reader, FoxIt, and some of the native PDF rendering don't provide that option.