Skip to main content
Participant
February 19, 2024
Question

Populate PDF form from c#.net

  • February 19, 2024
  • 1 reply
  • 18305 views

Hi Team,

 

I am new to the application, I am using the below code 

AcroPDDoc FormulairePDF = new AcroPDDoc();
// FormulairePDF.GetJSObject();
FormulairePDF.Open("I:\\RC7294.pdf");


var jso = FormulairePDF.GetJSObject();

jso.getField("FI_Name").Value = "Hyderabad";

 

The above code thorws error "Value does not fall within range".

 

I am trying to get the field name but couldn't.

 

Can you help me please.

 

Thanks,

Vinayak

This topic has been closed for replies.

1 reply

Thom Parker
Community Expert
Community Expert
February 19, 2024

Which line throws the error?

"var" is not a valid C# keyword. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
February 19, 2024

Thank you for your response, currently I am using windows form applicaiton and I want to populate the field in PDF form.

When I click the PDF in prepare form mode. I see the field name in PDF, the same I entered in application the erro throws.

 

Please can you help me with code altleat to populate one field or modify the above code.

 

Thank you

Thom Parker
Community Expert
Community Expert
February 19, 2024

Connecting to the Acobat JSO OLE interface through C# is not as straight forward as it should be. And it's nothing like the code you've presented. If you really want to use C#, you'll need to download the Acrobat SDK and go through the C# example that uses the JSO.     

However, I suspect that you are not a C# programmer. I would strongly suggest that you consider using VB, or VBA to connect to the Acrobat OLE interface. You'll find this much easier to deal with. 

 

Perhaps an even better approach would be for you to explain what you are trying to do. Then we could suggest approachs to a possible solution.

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often