Posts

Showing posts from December, 2012

Automating PDF with QTP just got easier!

Image
There are many ways in which pdfs can be automated , since it's been some time that I automated pdf related stuff; I found some new ways that are easier:

Apart from the older methods like:

For Adobe Reader:

Set rdrObj= createobject("AcroPDF.PDF")

rdrObj.LoadFile("C:\test.pdf")

rdrObj.PrintAll

Set rdrObj= Nothing
Note: This approach is good but has few options and can only be used for purposes like printing contents of the pdf file.

For Adobe Acrobat:

Set acrObj = CreateObject( "AcroExch.PDDoc" )

If acrObj .Open( FileName ) Then
       PagesinPdf = acrObj .GetNumPages()
       Set acrObj = Nothing
Else
       PagesinPdf = -1
End If

Note:
Set acrObj = CreateObject("AFormAut.App")--to manipulate from pdf formsSet acrObj = CreateObject("AcroExch.App")--creating acrobat application objectSet acrObj = CreateObject("AcroExch.AVDoc")--one avdoc object per displayed document. The best method would be:

APTT - Adobe Pdf Test Toolkit