Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
933 views
in Technique[技术] by (71.8m points)

java - Running a JavaScript command from MATLAB to fetch a PDF file

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);

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]')").

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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

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

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...