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

Fields gets striped out, when saved with PDF sharp
http://forum.pdfsharp.com/viewtopic.php?f=3&t=3929
Page 1 of 1

Author:  MoishyS [ Tue Mar 12, 2019 8:12 pm ]
Post subject:  Fields gets striped out, when saved with PDF sharp

Files filled out with Adobe Acrobat Pro, will stripe out all fields when saved with PDF sharp,
Try it with PDF from link below.
https://drive.google.com/open?id=1rginr-O2aAPRU2bLvQ1xo32WuDWM09yn
I tried adding NeedAppearances but that doesn't help

Code:
Private Sub PDFsharpSave(Path As String)
        Dim Doc As PdfDocument = IO.PdfReader.Open(Path)
        If Doc.AcroForm IsNot Nothing Then
            If Doc.AcroForm.Elements.ContainsKey("/NeedAppearances") = False Then
                Doc.AcroForm.Elements.Add("/NeedAppearances", New PdfSharp.Pdf.PdfBoolean(True))
            Else
                Doc.AcroForm.Elements("/NeedAppearances") = New PdfSharp.Pdf.PdfBoolean(True)
            End If
            Doc.Save(Path.Replace(".pdf", "_v2.pdf"))
       End If
End Sub

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