问题
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