cancel
Showing results for 
Search instead for 
Did you mean: 

Text Location verification in PDF documents

Joso
Visitor

Text Location verification in PDF documents

Hi There,

 

My AUT is a desktop based that generates a PDF report that I need to test. Apparently the report is a template in a tabular form. My goal is to verify that the text that I enter in the forms are populated in the report under different tables, based on the business logic. I need to verify that the text that I am searching for is printed in the correct tables in the PDF document, 

Although I can get the text that I am looking for, from the pdf, how do I ensure that the text is being printed under the correct tables? Could I get some help from the community regarding locating the exact location of the text from the  PDF? 

 

For eg:

In the attached screen print, how do I ensure the test "Heparin" is under Once only table and "Panadine" is under the Medication table? 

 

TIA!

2 REPLIES 2
tristaanogre
Community Hero

Re: Text Location verification in PDF documents

We have a simlar problem, only in our case, because of how the PDF is generated, we can't even check for the text.  

So... I've adapted the PDFBox code (https://support.smartbear.com/articles/testcomplete/testing-pdf-files-with-testcomplete) to do the following

 

1) Generate the PDF

2) Generate a BMP for the page I want to test

3) Use Regions.Compare logic, using a mask, to make sure that a baseline BMP file of the page and the test version match.

 

 


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
TanyaYatskovska
Community Manager

Re: Text Location verification in PDF documents

Hi @Joso,

 

It looks like using the image comparison suggested by @tristaanogre is one it the best options.

Also, you can play with the Intelligent Quality Add-On. This is one of the newest TestComplete features that provides Visual Recognition сapabilities with AI. You can create a script to check if a column contains the needed text. Please watch this video for more info:

https://smartbear.wistia.com/medias/u0ocowfyws

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors