9

how can i add Acroforms (or any inputfields) with pdfsharp lib to a pdf? For example a textbox (PdfSharp::Pdf::AcroForms::PdfTextField) I can't find any example for this, only read/modify.

I found "page->Elements->Add(key,pdfitem)", but i cant create a Object from PdfSharp::Pdf::AcroForms::PdfTextField or the others Forms (no Constructor)

user3600403
  • 339
  • 1
  • 2
  • 18
  • 1
    Please see my answer [here](https://stackoverflow.com/questions/54486608/c-create-pdf-form-acroform-using-pdfsharp/66003104#66003104) on how to add text field using PdfSharp. – reas Feb 03 '21 at 10:58
  • In 2022 there are numerous open source libraries for doing PDF manipulation and generation (see `pdf-lib` and `pdfme`) but they require skills in Node.JS development, which is not aligned with how the O.P. tagged this question. – bkwdesign Sep 09 '22 at 21:11

1 Answers1

0

Don't know if it is still relevant (maybe it will be relevant for other users), but it is not possible to do that with PDF Sharp, unfortunately, as if it would have had that functionality as well, it would have been a really nice rounded library. The AcroFrom functionality of the library only allows targeting already existing one.

Depending on what is your project for you can use iText sharp, but it has an AGPL license which is not ideal, there are other libraries but they are quite expensive. If it is a small pdf file (under 10 pages) you can use the free tier from the SpirePDF library.

In addition, there is PDFClown library which is open source (as long as you mention that you use it somewhere), but similarly to PDFSharp, it is quite old, and even less documented than PDFSharp.

Sadly, there aren't many solutions to this issue.

el-aasi
  • 307
  • 2
  • 18