Running JavaScript command from MATLAB to extract a PDF file

I am currently writing MATLAB code to interact with my company's internal reporting database. So far, I can access the abstract HTML page using code that 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 various bits of information from HTML text that ends in a variable s, however a PDF report file is available through what I consider JavaScript command (onClick = "gotoFulltext ('', '[Report Number]')").

Any ideas on 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 the Java solution will work ...)

+5
3

, JavaScript , -.

Firefox, FireBug.

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

, , URL- URL , JavaScript.

+4

URL- (a la pjp), , " PDF MATLAB". , , ""...


PDF, , MATLAB . URLREAD - , , URL- ,

s = urlread('url') URL s. , s .

, PDF, , s , :

s = urlread('http://samplepdf.com/sample.pdf');

PDF, . -, URLWRITE, URL- :

urlwrite('http://samplepdf.com/sample.pdf','temp.pdf');

MathWorks File Exchange PDF:

PDF , Adobe Acrobat OPEN:

open('temp.pdf');
+1
wb=com.mathworks.mde.webbrowser.WebBrowser.createBrowser;
wb.executeScript('javascript:alert(''Some code from a link'')');
desk=com.mathworks.mde.desk.MLDesktop.getInstance;
desk.removeClient(wb);
+1
source

All Articles