从JavaScript呼叫pdfium(Chrome原生pdf查看器) [英] Call pdfium (chrome native pdf viewer) from javascript

查看:370
本文介绍了从JavaScript呼叫pdfium(Chrome原生pdf查看器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道pdfium公开了javascript API(

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]

给我这个:

function anonymous()
 __proto__: Object
 <function scope>

在Chrome扩展程序的源代码中,pdf.js中包含以下功能:

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) {...}

但是它只允许'selectAll'消息.

But it only allows the 'selectAll' message.

如果有人能告诉我在哪里可以阅读更多信息或如何使用javascript与pdfium互动,我将不胜感激

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

推荐答案

Lu Wang基于pdf.js的UI为PDFium编写了一个JavaScript库:

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

这篇关于从JavaScript呼叫pdfium(Chrome原生pdf查看器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆