Forum Discussion

uusarath's avatar
uusarath
New Contributor
8 years ago

How can i read the content in PDF and validate using test complete? using TC11 with VB Scripting

Hi,

 

How can i read the content in PDF and validate using test complete?

Am Using TC11 with VB Scripting.

 

Mostly my PDFs are Untagged PDfs

 

Thanks in advance,

Sarat.

4 Replies

  • What exactly do you want to validate?

     

    Using QTPro and VBScript in the past, I simply opened the PDF. Sent it 'Select All' (CTRL + A) and then 'Copy' (CTRL+C) key presses. This copies all the text into the ClipBoard. Then copy the contents of the ClipBoard into a variable and use that.

     

    This only gets raw text. It won't get formatting or images. And it won't work on protected PDF's (not much does I don't think).

     

    I'm not familiar with untagged PDF's so not sure how that will affect it.

     

    This is a simple approach. But worked just fine for me, with no extra messing around (PDF's are generally not nice to work with). I used it to validate certain fields in hundreds of financial documents produced by an overnight run. I didn't care about formatting etc. Just that certain fields were populated with the right number/text. It was a statement type document so field names etc gave me good anchors to locate things with. 

     

    However, if you need something more complex, you may want to read this: https://support.smartbear.com/articles/testcomplete/testing-pdf-files-with-testcomplete/

  • m_essaid's avatar
    m_essaid
    Valued Contributor

    Hi,

     

    I use PDFBox.NET, make a search here some have already talked about it.