Configuring TestComplete to work with PDF files
Hello;
I am trying to configure TestComplete to extract text, images and other content from PDF files. I have followed the Preparation Steps, listed here, but when I run the loadDoucment() function, TestComplete throws an error saying the object doesn't support this property or method.
function loadDocument(fileName) { var docObj; // Load the PDF file to the PDDocument object docObj = JavaClasses.org_apache_pdfbox_pdmodel.PDDocument.load_3(fileName); // Return the resulting PDDocument object return docObj; }
I have tried to use both different versions of PDFBox (1.8.13 and 2.0.6), but it doesn't seem to make a difference.
I've also tried to use the code completion functionality built into the TestComplete script editor to "walk" into the classes and methods. When I do this, it looks like PDDocument is a property of org_apache_pdfbox_pdmodel, but not its own class with child methods and properties.
Ultimately, I need to be able to use the PDFBox library functionality, so more information about how to do that would be fantastic, but failing that, perhaps some information to have TestComplete validate the configurations I've made so far and confirm they are correct would also be useful. To be clear, I copy/pasted the information by hand from the help page, and have manually re-checked all the configurations made in JavaBridge, but I can't see where the given configurations and my local configurations are different.
Can anyone help?
I believe I have the problem solved - I am now able to see member methods and properties using the code completion function in TestComplete (see attached screenshot).
I think the root cause of my issue was version incompatibility. I downloaded and used jars from different PDFBox versions, and I had to go back to 1.8.9 to find a version that worked with TestComplete 10.