Reading PDF documents
I am trying to follow the steps here for reading the contents of a pdf document and have converted the code to VBS. I have done the setup successfully and now I am trying to get the pdf file object.
When I execute the following I get java.lang.IllegalArgumentException: argument type mismatch.
I have tried all of the 'load' overload options but can't get the code to work. What am I doing wrong?
For future reference - where can I get a list of each of the overload options, that expands on "Param1 as Object", for this or any other object?
VBScript
function loadDocument(byval fileName)
dim docObj
'Load the PDF file to the PDDocument object
set docObj = JavaClasses.org_apache_pdfbox_pdmodel.PDDocument.load_3(fileName) 'FAILS HERE
'Return the resulting PDDocument object
set loadDocument = docObj
end function
sub testPDF
set docObj = loadDocument("C:\\Temp\\Document.pdf")
end sub
Fixed thanks to this post by AlexKaras. I was using the latest version pdfbox-app-2.0.3.jar and needed to used the old pdfbox-app-1.8.12.jar
Looks like my original thread has expanded a bit.
I use VBScript and the code does apply but it looks like the "set" statement has been omitted
set docObj = JavaClasses.org_apache_pdfbox_pdmodel.PDDocument.load_3("C:\\Users\\Downloads\\Test.pdf")