Selector issue in Editable PDF

Hi Guys,

I have been trying to fill the editable text boxes in a PDF documents from the data read from an excel file. I have done similar work earlier as well however, this time I am having some weird container issue in my editable PDF document.

I have set the correct preferences as well as the accessibility that works well for PDF automation (as per my knowledge from the prior projects) however still everytime I am trying to fetch the selector of those text boxes, the entire document is coming under one container (the blue screen). I have also tried opening the document in the browser thinking it might help me fetch the selectors for the boxes, but no success there too. I am trying to use the Anchor Base activity, so that my bot searches the header first and then in the text box beside that header, it can type the required data using type into activity.

But it will just not work. I could really use some good advice here!!



Can you share the PDF , so that I can look into the issue

Try opening any properties window (for eg : ctrl+k) and close it while Robot is trying to search for selector (keep 30 second timeout) and let me know if it works after you close the window.

Hi @kaustavc1991 check this out

Form.pdf (503.7 KB)

Attached is the sample form that I have made editable. I need to fill this form with sample data from an excel.

Hi Sanjay. I tried your solution but it’s not working in my end. Screenshot attached for your reference, could you please have a look and tell where am I going wrong? Thank you in advance

Hi @Kaustavc1991

I Tried to fill the form and its working fine using Powershell below is the script am sharing with you

[System.Reflection.Assembly]::LoadFrom(“D:\sanjay\pdf_extraction\itextsharp.dll”) | Out-Null
$PDFDoc = New-Object iTextSharp.text.pdf.PdfReader -ArgumentList “D:\sanjay\pdf_extraction\Form.pdf”
$PDFDoc_ = New-Object iTextSharp.text.pdf.PdfStamper($PDFDoc,[System.IO.File]::Create(“D:\sanjay\pdf_extraction\filled_form.pdf”))

$PDFDoc_.AcroFields.SetField(“Tax file number TFN”,“123456789”) | Out-Null
$PDFDoc_.AcroFields.SetField(“Company information”,“123”) | Out-Null
$PDFDoc_.AcroFields.SetField(“undefined_2”,“789”) | Out-Null
$PDFDoc_.AcroFields.SetField(“undefined_3”,“456”) | Out-Null

$PDFDoc_.AcroFields.SetField(“Day”,“1”) | Out-Null
$PDFDoc_.AcroFields.SetField(“Month”,“11”) | Out-Null
$PDFDoc_.AcroFields.SetField(“Year”,“2018”) | Out-Null
$PDFDoc_.AcroFields.SetField(“Name of company”,“Capgemini”) | Out-Null


the Screenshot of result

Do find the sample workflow using Ui-path Enjoy :slight_smile: (1.9 MB)

Note:- While Running this Script close the Pdf file

Sanjay Shankhla

1 Like

hi @nishakankaria
Could please run your script in windows powershell ISE and
share me the screenshot

Thanks for the quick response. I have attached the screenshot, please have a look. Also, I don’t know how powershell scripting works, I just opened the powershell app and pasted the text.

1 Like

One Suggestion You can use run power shell script activity rather than using invoke powershell
please give a try hope it works because i see in the script it has ran perfect

Regrds :slight_smile:
Sanjay Shankhla

Hi, I’m using UiPath Studio 2018.2.3 version and could only find ‘Invoke powershell’ activity.

hi @nishakankaria

Request you to install python package s

Hi, thanks for your quick response.
Python script is already installed and I have now installed everything that was pending in the package, but still that activity is not showing up. I guess, I need to install latest version of UiPath 3.0

hi @nishakankaria ,
i believe you are missing this package

Thanks, I could see the run powershell activity now.

Hi, I’m getting an error while running this. Screenshot attached for your reference, could u please have a look and let me know what’s going wrong?

I need your help to understand this process.
We want to fetch values from excel and fill the pdf with that data. In the script, you have hard coded the values, how can this be made dynamic so it extracts value from excel and fill multiple pdfs in loop?

Thank you so much in advance.


Could please share me you excel file and pdf ill explore over it,

Regards :slight_smile:
Sanjay Shankhla

Thank you Sanjay for your help.
I have attached the PDF, it is same as shared by Kaustav. I’m unable to upload the Microsoft Excel Macro-enabled worksheet as ‘.xlsm’ format is not supported here. Would you please create macro worksheet/.xlsm file at your end and fill in some dummy data?

editable pdf format - Copy.pdf (503.2 KB)

Can you let me know how can I get the pdf data using powershell , just give me a small example of how to extract data using powershell and then how can I get that data in uipath variable.

Hi @nishakankaria,
you can now pass dynamic variables and execute the script changed a little bit have look
below (2.0 MB)

You can pass the variables using powershellvariableproperty

Sanjay Shankhla