Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Populate PDF form from c#.net

New Here ,
Feb 19, 2024 Feb 19, 2024

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

TOPICS
Windows
17.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 19, 2024 Feb 19, 2024

Which line throws the error?

"var" is not a valid C# keyword. 

 

 

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 19, 2024 Feb 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 19, 2024 Feb 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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 19, 2024 Feb 19, 2024

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 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 20, 2024 Feb 20, 2024
LATEST

The answer you seek is in the SDK examples:

https://opensource.adobe.com/dc-acrobat-sdk-docs/acrobatsdk/toc.html

 

 

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines