Forum Discussion

MulgraveTester's avatar
MulgraveTester
Frequent Contributor
9 years ago
Solved

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