从MATLAB运行JavaScript命令以获取PDF文件 [英] Running a JavaScript command from MATLAB to fetch a PDF file

查看:109
本文介绍了从MATLAB运行JavaScript命令以获取PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在编写一些 MATLAB 代码,以便与我公司的内部报告数据库进行交互。到目前为止,我可以使用如下代码访问HTML抽象页面:

I'm currently writing some MATLAB code to interact with my company's internal reports database. So far I can access the HTML abstract page using code which looks like this:

import com.mathworks.mde.desk.*;
wb=com.mathworks.mde.webbrowser.WebBrowser.createBrowser;
wb.setCurrentLocation(ReportURL(8:end));
pause(1);

s={};
while isempty(s)
    s=char(wb.getHtmlText);
    pause(.1);
end
desk=MLDesktop.getInstance;
desk.removeClient(wb);

我可以从HTML文本中提取出各种信息,最后是变量 s ,但报告的PDF是通过我认为的 JavaScript 命令(onClick =gotoFulltext('','[Report Number]'))。

I can extract out various bits of information from the HTML text which ends up in the variable s, however the PDF of the report is accessed via what I believe is a JavaScript command (onClick="gotoFulltext('','[Report Number]')").

关于我如何执行此操作的任何想法JavaScript命令并将PDF文件的内容转换为MATLAB变量?

Any ideas as to how I execute this JavaScript command and get the contents of the PDF file into a MATLAB variable?

(MATLAB位于Java之上,所以我相信Java解决方案可以工作......)

(MATLAB sits on top of Java, so I believe a Java solution would work...)

推荐答案

我认为你应该看一下被调用的JavaScript,看看对webserver的最终请求是什么样的。

I think you should take a look at the JavaScript that is being called and see what the final request to the webserver looks like.

您可以使用FireBug插件在Firefox中轻松完成此操作。

You can do this quite easily in Firefox using the FireBug plugin.

https://addons.mozilla.org/en-US/firef ox / addon / 1843

找到真正的服务器请求后,您只需请求此URL或发布到此URL,而不是尝试运行JavaScript。

Once you have found the real server request then you can just request this URL or post to this URL instead of trying to run the JavaScript.

这篇关于从MATLAB运行JavaScript命令以获取PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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