Forum Discussion

Joso's avatar
Joso
Visitor
6 years ago

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

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    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.

     

     

    • TanyaYatskovska's avatar
      TanyaYatskovska
      SmartBear Alumni (Retired)

      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