Ask a Question

Is it possible for extracting data from a table in a PDF file with python in testcomplete?

ykrrishna
Occasional Contributor

Is it possible for extracting data from a table in a PDF file with python in testcomplete?

I am automating the fetching of a particular data from several PDF files in a same or similar format.

 

Note : The data lies in a table ; The PDF has images ; Python scripting is preferred ;

3 REPLIES 3
tristaanogre
Esteemed Contributor

Unfortunately, PDF's are a real bear to work with.  They are not open, usually, to getting information straight from them.

Fortunately, a couple of versions back, the SmartBear folks wrote up a nice document on how to utilize a PDFBox library to parse out text from a PDF.  You can check it out at https://support.smartbear.com/articles/testcomplete/testing-pdf-files-with-testcomplete/

 

One note: This will simply extract text.  It will not bring the information in as a "table" structure or anything like that, at least, not that I can tell from first glance. So, you will need to extract the text and then use an aqString find method to find the text in it's particular context.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
ykrrishna
Occasional Contributor

Isnt this utilize java scripting ?

 

Am currently working in a python project, so am not sure abut using this alone in java . Will it work ?

I did run across it on my initial search but I skipped it as it said it is handled with java classes !

 

Kindly bare if its a lame question but still I am not clear weather I can use this in my project !

tristaanogre
Esteemed Contributor

As far as I know, you can use the JavaBridge even in a Python project.  The idea of the JavaBridge is similar to the .NET CLR stuff in TestComplete... you can bring in and incorporate these kinds of classes and objects in your project and then utilize them, regardless of your scripting language of choice.  Obviously, you would need to adapt the code in the article to by for Python, something that I am not qualified to do because the only thing I really know about Python is that it exists and is supported in TestComplete.  Sorry. 


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: