带有外部文件上传的pdffs查看器 [英] Pdfjs viewer with external file upload

查看:62
本文介绍了带有外部文件上传的pdffs查看器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用div.js API方法(例如运行和打开)在div的网页中加载pdf.js查看器.

I am loading the pdf.js viewer in my webpage in a div using the pdf.js API methods such as run and open.

在此页面中,我还有一个文件上传部分,用于附加相关文档.

In this page I also have a file upload section to attach related documents.

问题是当我在文件上传部分中使用dropzone上传文档时,pdf查看器认为我正在向其中上传文档并更改了现有文档.是否有关闭此设置的设置?我以为network.js中会有东西,但是我还没有发现有希望的东西.

The issue is when I upload a document in the file upload section, using dropzone, the pdf viewer thinks I am uploading a document to it and changes the existing document. Is there a setting to turn this off? I thought there would be something in network.js but I haven't found anything promising yet.

推荐答案

这是PDFViewerApplication中令人讨厌的部分,它添加了一个全局 change 事件监听器,并且如果pdf是选择了文件的文件输入,则会对其进行更改.

Here is the offending part in PDFViewerApplication, it adds a global change event listener and changes the pdf if it's a file input with files selected.

不幸的是,没有设置标志来禁用此行为,没有引用侦听器功能将其删除,也没有办法取消或更改事件(这也会破坏应用程序的其他部分),因此您将必须修改此代码以将其删除.好像侦听器只是调度一个新的内部 fileinputchange 事件(仅用于此事件),因此您只需要注释掉

Unfortunately there is no settings flag to disable this behaviour, no reference to the listener function to remove it, and also no way to cancel or change the event (it would also break other parts of the app), so you'll have to modify this code to remove it. Seems like the listener just dispatches a new internal fileinputchange event which is only used for this, so you only need to comment out this line.

这篇关于带有外部文件上传的pdffs查看器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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