简体   繁体   English

有没有办法使用pdf.js为pdf渲染编写javascript事件

[英]Is there way to write javascript events for pdf render using pdf.js

I have a scenario where I been asked to make online PDF viewer and on viewing mode the user would select certain area of the PDF and upon selection the marked area boundary wrst pdf should sent to the server. 我有一个场景,我被要求制作在线PDF查看器,并且在观看模式下,用户将选择PDF的某个区域,并且在选择时,标记的区域边界将首先发送到服务器。

example If the User click a area of say created at date the boundary of the selected area should be sent to the server 示例如果用户单击日期创建的区域,则应将所选区域的边界发送到服务器

Now I googled around, and I found that Pdf.js can handle the rendering of pdf in browser. 现在我用Google搜索,我发现Pdf.js可以在浏览器中处理pdf的渲染。 Can I, by any chance, associate the event with the PDF pages as I mention above or should I look for some other solution like flash 如上所述,我是否可以将事件与PDF页面相关联,或者我应该寻找其他解决方案,如flash

Regards 问候

In the viewer.js , there are some listeners like: viewer.js ,有一些听众喜欢:

  • window.addEventListener('mousedown', function mousedown(evt) {..}
  • window.addEventListener('mousemove', function keydown(evt) {..}

You can use those to do the logic of your dragging, selecting, .. 您可以使用它们来执行拖动,选择,...的逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM