简体   繁体   中英

Itext7 Fill and modiffy PDF in c# asp.net

I am looking at this example

I am trying the code below to run to fill a document in c# asp.net .

string src = @"C:\documents\BlankContracts\Document 50.pdf";
    string dest = @"C:\documents\BlankContracts\123.pdf";
    PdfDocument pdfDoc =
new PdfDocument(new PdfReader(src), new PdfWriter(dest));
    // add content
    PdfAcroForm form = PdfAcroForm.GetAcroForm(pdfDoc, true);
            Map<string, PdfFormField> fields = form.GetFormFields();

It keeps giving me an error on the part where it tries to get the list of fields. It keep asking me to create a class for Map. If any one know how to do this please let me know. I have been going all over the place but couldn't find place where it shows how exactly can I fill out a PDF using the newer version Itext7 Thanks

Of course the compiler want you to specify Map . Also, according to examples which you shared, you should change it

Map<string, PdfFormField> fields = form.GetFormFields();

to;

IDictionary<String, PdfFormField> fields = form.GetFormFields();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM