# How to fill in editable PDF?

Hey,
After I have been reading all the topics concerning this issue on the forum, I can not sill fill the editable fields in the pdf.
The selectors are not recognized.
What tips would you give me?
Thanks

Hi @EngAnalyst
you can do it using power shell script

Thanks. and how to fill ?

Hi @EngAnalyst
PFB powershell script , write the below code in powershell and change the file paths accroding to your system local path for itextsharp.dll and for pdf file.

$PDFDoc.AcroFields.Fields = this line will give you all the editable fields name in the pdf$PDFDoc.AcroFields.SetField(name, value); = this line will help you to set the editable field in the pdf . here name is the field name and value = value you want to set to that field.

pdf_extraction (2).zip (1.3 MB)

--------code--------
$PDFDoc = New-Object iTextSharp.text.pdf.PdfReader -ArgumentList “C:\Users\username\Downloads\pdf_extraction\pdf_extraction\ee.pdf”$PDFDoc.AcroFields.Fields
$PDFDoc.AcroFields.SetField(name, value); 2 Likes Thanks a lot. After modifying the file paths according to my local system and executing the Power Shell the error is shown (i just want first to see the fields): PS C:\Users\EngAnalyst\Desktop\pdf_extraction\pdf_extraction> C:\Users\EngAnalyst\Desktop\pdf_extraction\pdf_extraction\pdf_acrofield.ps1 Add-Type : Could not load file or assembly ‘file:///C:\Users\EngAnalyst\Desktop\pdf_extraction\pdf_extraction\itextsharp.dll’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) At C:\Users\EngAnalyst\Desktop\pdf_extraction\pdf_extraction\pdf_acrofield.ps1:1 char:1 • Add-Type -Path "C:\Users\EngAnalyst\Desktop\pdf_extraction\p … •  + CategoryInfo : NotSpecified: (:) [Add-Type], FileLoadException + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.AddTypeCommand  New-Object : Cannot find type [iTextSharp.text.pdf.PdfReader]: verify that the assembly containing this type is loaded. At C:\Users\EngAnalyst\Desktop\pdf_extraction\pdf_extraction\pdf_acrofield.ps1:2 char:11 •$PDFDoc = New-Object iTextSharp.text.pdf.PdfReader -ArgumentList "C:\ …
•       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

• CategoryInfo : InvalidType: ( [New-Object], PSArgumentException
• FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

Why ?

It’s solved. I have just unblocked the .dll file and now it works.

Thanks a bunch!

1 Like

great

One last question @rishi1
When using $PDFDoc.AcroFields.SetField(name, value); a error is shown: After half an hour I do not get to solve it… Why? 1 Like$PDFDoc.AcroFields.Fields = when you are executing this line are you getting the field you are trying to set.

Yes and then I use:

$PDFDoc.AcroFields.SetField(“Field1”, “Hello”); where Field1 is the name of the “Key” I get after the command line:$PDFDoc.AcroFields.Fields
And that is the error I get…

Thank you @rishi1

can you just check the code for the pdf i have given in th zip

Yes i think i am doing everything alright…

Edit: it seems to be a problem with the editable pdf since i have tried with another one and it works.
The issue now is why it is happening to my editable pdf…

yeah it looks like an issue with the pdf, is it possible for you to share your pdf?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.