Forum Discussion

ramuboj's avatar
ramuboj
New Contributor
13 years ago

How to verify the text content in a PDF file.

Using Keyword testing-how to verify the text content in a PDF file.
  • dyoshida's avatar
    dyoshida
    New Contributor
    If you need to check text content of the pdf, then you could always select all the text from the PDF, copy it to the clipboard (keys("^c")) and do a string compare against window's clipboard.
  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Ramu,


    You can use any of the following approaches:


    1. Create a File checkpoint that will compare the actual PDF file with the baseline copy stored along with the TestComplete project.


    See the File Checkpoints section for more information.


    2. Use free third-party .NET and Java libraries such as PDFBox or iText for your needs. You can call them from your tests via TestComplete's CLR Bridge and Java Bridge.


    See the following forum threads for examples of using these libraries: How to get the content of a pdf file on window and How to reference a .NET assembly.


    I hope this information helps :)