PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Adobe Extended Features - Form Filling
http://forum.pdfsharp.com/viewtopic.php?f=2&t=3749
Page 1 of 1

Author:  sigonuk [ Sun Mar 25, 2018 5:10 pm ]
Post subject:  Adobe Extended Features - Form Filling

I have just been playing with PDFSharp 1.50RC1 and its looking excellent!
I am using it to complete a PDF form which works well but when I open the output file there are two issues:

1. I receive a message saying "This document enabled extended features in Adobe Acrobat Reader"
2. The fields are no longer editable in Adobe Acrobat Reader after the document has been amended.

I know if another PDF .NET application that you have to open the document as APPEND to resolve the same error but I haven't been able to find a way to resolve it.

Has anyone else had this and maybe could help?
I have attached the code I am using below (which is pretty straight forward):

Private Sub PDFSharpFillForm()
Dim mypdfdocument As New PdfSharp.Pdf.PdfDocument
mypdfdocument = PdfSharp.Pdf.IO.PdfReader.Open("c:\open\form1.pdf", PdfSharp.Pdf.IO.PdfDocumentOpenMode.Modify)
Dim form As PdfSharp.Pdf.AcroForms.PdfAcroForm = mypdfdocument.AcroForm
If form.Elements.ContainsKey("/NeedAppearances") Then
form.Elements("/NeedAppearances") = New PdfSharp.Pdf.PdfBoolean(True)
Else
form.Elements.Add("/NeedAppearances", New PdfSharp.Pdf.PdfBoolean(True))
End If
Dim testField As PdfSharp.Pdf.AcroForms.PdfTextField = CType(form.Fields("P1_Crematorium"), PdfSharp.Pdf.AcroForms.PdfTextField)
testField.Text = "My Crematorium"
mypdfdocument.Save("c:\open\form1-PDFSharp.pdf")
End Sub

----------------------------------------------------------------------------------------------------------------------
ANOTHER .NET PDF Application resolved this by issuing the following command when opening the document (if it helps):

PdfStamper ps = new PdfStamper(pr, fs, '\0', true);

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/