Populate PDF form from c#.net
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Which line throws the error?
"var" is not a valid C# keyword.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Hi Thom,
I am able to run the code from VBA, but want to do it from c#. below is senario what I am trying to acheive.
The data is coming from sql server, the application windows desktop applicaiton c#. and attached is the image for population the field, one image is with textbox and one with its id.
I want to populated the data from sql to PDF with c# windows forms applicaiton.
Hope this explains
Copy link to clipboard
Copied
The answer you seek is in the SDK examples:
https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/toc.html
Use the Acrobat JavaScript Reference early and often

