Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8761749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:21:52+00:00 2026-06-13T15:21:52+00:00

I have some PDFs which I would like to fill out automatically using C#.

  • 0

I have some PDFs which I would like to fill out automatically using C#. I know about iTextSharp, but I am unsure about licensing issues for business use, and would rather find a different solution.

Basically, I would like to open a PDF, specify the field (or give coordinates for a textbox) and be able to insert text (& possibly small images?). Then I need to merge and save the pdf.

Any suggestions for a good way to accomplish this where I don’t have to purchase / worry about licenses?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T15:21:54+00:00Added an answer on June 13, 2026 at 3:21 pm

    Not sure what the advantages of iTextSharp are, but I found a solution that is working perfectly so far using PDFSharp! As documentation seems to be a little on the light side for PDFSharp, I also found this thread to be very helpful…

    If this helps anybody, here is my sample program:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.IO;
    using PdfSharp.Fonts;
    using PdfSharp.Pdf;
    using PdfSharp.Pdf.IO;
    using PdfSharp.Pdf.AcroForms;
    
    namespace PDFSharpTest
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void goButton_Click(object sender, EventArgs e)
            {
                //TestPDF();  //uncomment this to find out whether acroform will work correctly         
    
                //open file
                PdfDocument pdf = PdfReader.Open(@"YOURFILEPATHandNAME", PdfDocumentOpenMode.Modify);
    
                //fix some odd setting where filled fields don't always show                   SetupPDF(pdf);
    
                //find and fill fields
                PdfTextField txtEmployerName = (PdfTextField)(pdf.AcroForm.Fields["txtEmployerName"]);
                txtEmployerName.Value = new PdfString("My Name");
    
                PdfTextField txtEmployeeTitle = (PdfTextField)(pdf.AcroForm.Fields["txtEmployeeTitle"]);
                txtEmployeeTitle.Value = new PdfString("Workin'");
    
                PdfCheckBoxField chxAttached = (PdfCheckBoxField)(pdf.AcroForm.Fields["chxAttached"]);
                chxAttached.Checked = true;
    
                //save file
                pdf.Save(@"NEWFILEPATHandNAMEHERE");
            }
    
            private void SetupPDF(PdfDocument pdf)
            {
                if (pdf.AcroForm.Elements.ContainsKey("/NeedAppearances") == false)
                {
                    pdf.AcroForm.Elements.Add("/NeedAppearances", new PdfSharp.Pdf.PdfBoolean(true));
                }
                else
                {
                    pdf.AcroForm.Elements["/NeedAppearances"] = new PdfSharp.Pdf.PdfBoolean(true);
                }
            }
    
            private void PDFTest()
            {
                OpenFileDialog ofd = new OpenFileDialog();
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    PdfDocument _document = null;
                    try { _document = PdfReader.Open(ofd.FileName, PdfDocumentOpenMode.Modify); }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "FATAL");             //do any cleanup and return             
                        return;
                    }
                    if (_document != null)
                    {
                        if (_document.AcroForm != null)
                        {
                            MessageBox.Show("Acroform is object", "SUCCEEDED");
                            //pass acroform to some function for processing          
                            _document.Save(@"C:\temp\newcopy.pdf");
                        }
                        else
                        {
                            MessageBox.Show("Acroform is null", "FAILED");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Unknown error opening document", "FAILED");
                    }
                }
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application which generates PDFs. Now I'm using Apache FOP just for
I have created new PDFs many times using Zend and PHP. But Now I
I have some text lines like that : vt_wildshade2^508^508 vt_ailleurs2^1188^1188 ... vt_high2^13652^13652 Is it
I have some tables roughly like so: Client: id name Employee id name Email
I am writing some PHP code to create PDFs using the FPDF library. And
i am using apache fop 1.0 to create some pdfs for customers for one
Let's say I have a collection of PDF files with the following paths: /some/path/pdfs/birds/duck.pdf
I have a MonoTouch application that generates some PDFs locally and then prints them
I have a bank of pdfs on my server which when downloaded need text
I have a php script that does some processing (creates remittance advice PDFs, self-billing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.