gpt4 book ai didi

javascript - 如何从 pdftron webviewer 获取表单数据

转载 作者:行者123 更新时间:2023-11-29 19:13:09 25 4
gpt4 key购买 nike

我有一个 PDFTron webviewer,我用它来呈现 pdf 表单。当用户单击外部保存按钮时,我需要从 webviewer 中提取表单 xml。

我试过了

var am = readerControl.docViewer.getAnnotationManager();
var xfdfString = am.exportAnnotations();

$.ajax({
type: 'POST',
url: readerControl.serverUrl + '?did=' + readerControl.docId,
data: xfdfString,
success: function(data) {
// Annotations were successfully uploaded to server
},
error: function(jqXHR, textStatus, errorThrown) {
console.warn("Failed to send annotations to server. " + textStatus);
},
dataType: 'xml'
});

但我无法在 PDFTron config.js 之外获取 readerControl。请帮忙

最佳答案

config.js 是 webviewer 修改的首选位置,因为它在查看器的 iframe 窗口的上下文中执行。在以下教程中有更多相关信息:

https://www.pdftron.com/webviewer/demo/tutorials/getting-started-config-files.html

或者,您可以通过 contentWindow 访问 iframe 变量,如以下帖子所述:https://stackoverflow.com/a/13758233/1710586

关于javascript - 如何从 pdftron webviewer 获取表单数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37320786/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com