Call pdfium (chrome native pdf viewer) from javascript

半腔热情 提交于 2019-12-22 08:06:43

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/34276680/call-pdfium-chrome-native-pdf-viewer-from-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!