Forum Discussion

nastester's avatar
nastester
Regular Contributor
2 months ago

Adding a PDF file to Stores/Files in script

I am trying to add a PDF file to my Stores/Files in a script.

I have this:

function test() {
  if (!Files.Add("C:\\Users\\" + Sys.UserName + "\\Downloads\\Text_Messaging_" + 
  aqConvert.DateTimeToFormatStr(aqDateTime.Today(), "%m" + "_" + "%d" + "_"  +"%Y") + ".pdf"))
    Log.Message(Files.LastError);
}

The issue is it is adding the file as a binary file and not the recognized text (which you can do through the TestComplete GUI):

So I see this:

instead of the plain text in the PDF:

 

How can I add the text recognition feature to my script?