RobertStCyr Absent Member.
Absent Member.
529 views

Error Message Running below Code

Attempting to use the following script to retrieve specific text from a pdf file, but receive a syntax error message indicating expected end of statement for the first line.  Not sure why, it is just a Dim statement.

 

Dim AcroApp As Acrobat.CAcroApp

Dim theForm As Acrobat.CAcroPDDoc

Dim jso As Object

Dim str As String

 

Set AcroApp = CreateObject("AcroExch.App")

Set theForm = CreateObject("AcroExch.PDDoc")

 

theForm.Open ("c:\ConfirmationpageIVV-0952014122338-Opp1.pdf")

 

Set jso = theForm.GetJSObject

 

'get the information from the form field

 

str = jso.getField("tracking_number").Value

MsgBox str

 

theForm.Close

AcroApp.Exit

Set AcroApp = Nothing

Set theForm = Nothing

0 Likes
2 Replies
Ruddy_A_FT Outstanding Contributor.
Outstanding Contributor.

Re: Error Message Running below Code

Hi Robert,

 

Hope you are doing well.

 

My name is Ruddy from QTP/UFT Team and want to help you on this question.

 

QuickTest Professional 9.2 - 11.0

QuickTest Professional does not have special support for working with PDF documents.
Related articles

 

Document ID KM179487 - How to find text in a .pdf file
Document ID KM199334 - How to capture text from a PDF file
Document ID KM1355590 - Is there any example code on how to use the AcrobatPDF API?

 

Unified Functional Testing 11.5 +

File Content Checkpoints
You can use file content checkpoints to compare the textual content of a file that is generated during a run session with the textual content of a source file. This enables you to verify that the generated file contains the expected results.

For example, you may want to verified that aPDF file generated during a run session displays the local corporate address at the top of every page.


You can perform a checkpoint on text in one line, multiple lines, or the entire document, as needed. You can also specify what to ignore. For example, if you expect certain lines or areas in the file to change, you can exclude them from the checkpoint.


When you select a source document to compare, UFT converts a copy of this document to a text file and displays the content in the file content editor area of the File Content Checkpoint Properties Dialog Box, enabling you to configure your checkpoint. You can use parameters and regular expressions to augment your checkpoint, as needed.


For more information, see "File Content Checkpoints" on the User Guide
 
Hope you will find well this information.
 
Please mark this answer as accepted solution or correct answer if this answered your question.
 
Best regards,

Ruddy Alvarez H.
Customer Support Engineer

If you find thst aat this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the pond show your appreciation.
0 Likes
RobertStCyr Absent Member.
Absent Member.

Re: Error Message Running below Code

Hi, Thanks for your response, however, I am not able to view those articles you sent.  It says I am not authorized to view the document.  I am not sure why.  The SAID I used in the one associated with the account.

 

Regards,

Paul

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.