PDFSharp filling in form fields

You also need this if you are attempting to populate PDF form fields, you also need to set the NeedsAppearances element to true. Otherwise the PDF will “hide” the values on the form. Here is the VB code.

If objPdfSharpDocument.AcroForm.Elements.ContainsKey("/NeedAppearances") = False Then
    objPdfSharpDocument.AcroForm.Elements.Add("/NeedAppearances", New PdfSharp.Pdf.PdfBoolean(True))
Else
    objPdfSharpDocument.AcroForm.Elements("/NeedAppearances") = New PdfSharp.Pdf.PdfBoolean(True)
End If

Leave a Comment

tech