Click here to Skip to main content
15,888,733 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am using PDFSharp.dll to edit the pdf file and save it on local machine. It is working fine, i am able to update the existing text field value. But the problem is when i open updated file in pdf reader the text field is blank until clicked on it.

I can see the value if open that pdf in crome pdf reader. only problem with acrobat pdf reader.

Could any please help me why value is hidden in acrobat pdf reader? any kind of help will me much appreciated.

What I have tried:

C#
if (!Document.AcroForm.Elements.ContainsKey("/NeedAppearances"))
    Document.AcroForm.Elements.Add("/NeedAppearances", new PdfBoolean(true));
else
    Document.AcroForm.Elements.Add("/NeedAppearances", new PdfBoolean(true));

PdfTextField texttField =  (PdfTextField)Document.AcroForm.Fields[field.DataField.DocumentMapAddress];
                       
PdfString pdfStr = new PdfString(field.UserEnteredValue.ToString());
texttField.Font = new XFont("Arial", 8);
texttField.Value = pdfStr;
Posted
Updated 18-Aug-20 4:30am
v2

1 solution

if (!Document.AcroForm.Elements.ContainsKey("/NeedAppearances"))
Document.AcroForm.Elements.Add("/NeedAppearances", new PdfBoolean(true));
else
Document.AcroForm.Elements["/NeedAppearances"]
= new PdfBoolean(true));
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900