Fernando Gonzalez
Fernando Gonzalez

Reputation: 148

Call pdfium (chrome native pdf viewer) from javascript

I am aware that pdfium exposes a javascript API (see this question). But I can't find how to call those functions. On a page with a rendered PDF I can see an embed tag, but I don't know what to do with it.

var p =  document.getElementsByTagName('embed')[0]

Gives me this:

function anonymous()
 __proto__: Object
 <function scope>

And in the source code of the Chrome extension, there is this function in pdf.js:

  /**
* Handle a scripting message from outside the extension (typically sent by
* PDFScriptingAPI in a page containing the extension) to interact with the
* plugin.
* @param {MessageObject} message the message to handle.
*/
 handleScriptingMessage: function(message) {...}

But it only allows the 'selectAll' message.

I would really appreciate if anyone can tell me where can I read more info on this or how to interact with pdfium with javascript

Upvotes: 5

Views: 2662

Answers (1)

Michael W. Czechowski
Michael W. Czechowski

Reputation: 3457

Lu Wang wrote a javascript library for PDFium based on the UI of pdf.js: Source code on github of PDFium.js

Upvotes: 1

Related Questions