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

AcroForm fields not displaying in some Pdf Viewers
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4557
Page 1 of 1

Author:  kashgoyal [ Thu Feb 29, 2024 10:06 am ]
Post subject:  AcroForm fields not displaying in some Pdf Viewers

Hi,
I am using PDFsharp Acroforms to generate a PDF in my c# code.

When I open the downloaded pdf form ideally it should show all the fields with values but currently some fields are visible and some are not in the form. This is reproducible across both Windows and Mac.

Also the same file when opened using Browser (Chrome or Edge) the fields are visible but same file shows fields as missing in Mac preview and pdf xChange in Windows.

Is this a known bug or are we missing something to include in the code that is creating this random issue. Can someone please help in here?

Regards,
kashgoyal

Author:  smuldr [ Fri Mar 01, 2024 6:03 pm ]
Post subject:  Re: AcroForm fields not displaying in some Pdf Viewers

I am having this same issue as well.

I create a PdfDocument and then do the following:

Code:
// Access the AcroForm
var form = document.AcroForm;
form.Fields["StudentName"].Value = new PdfString(student.FullName!);


I have tried some of the suggestions mentioned on this forum and elsewhere but with no luck.

I've tried doing document.Flatten(), however this only flattens the fields for the file if it is opened up in a browser not in Adobe Acrobat.

The values are there on the pdf when opened in Adobe Acrobat, however I am unable to view them unless I click on the specific field and I believe this is due to that field not being flattened.

Author:  kashgoyal [ Mon Mar 04, 2024 5:59 am ]
Post subject:  Re: AcroForm fields not displaying in some Pdf Viewers

Thanks for your input smuldr. Yeah, I think there is something weird with this as I am also doing the document flatten in my code.

Hi PDFSharp Team,

Can anyone help in here as this issue seems to be weird with different scenarios.

Author:  smuldr [ Mon Mar 04, 2024 12:57 pm ]
Post subject:  Re: AcroForm fields not displaying in some Pdf Viewers

Kashgoyal I have a question for you. How do you flatten your document?

The only thing I can find is:
Code:
document.Flatten()


This seems to have the same issue I previously mentioned. It flattens the document only when the file is viewed in the browser.

If the file is viewed inside of say Adobe Acrobat the file is not flattened and the values are still only viewable when it is clicked on.

Author:  kashgoyal [ Tue Mar 05, 2024 2:12 pm ]
Post subject:  Re: AcroForm fields not displaying in some Pdf Viewers

smuldr

I am using the same code for flattening. For me the file shows correctly on acrobat adobe reader.

If I remove document.Flatten then the field shows on clicking over the fields.

Author:  kashgoyal [ Tue Mar 19, 2024 11:32 am ]
Post subject:  Re: AcroForm fields not displaying in some Pdf Viewers

Hi Team,
Can someone help in here please?

Author:  TH-Soft [ Tue Mar 19, 2024 2:08 pm ]
Post subject:  Re: AcroForm fields not displaying in some Pdf Viewers

AIUI Adobe Reader will show the "appearance" you provide for the fields.
If no appearance is given, nothing will be shown.

PDFsharp does not fully support form fields and code to add the appearance automatically will not be added to PDFsharp in the foreseeable future.
This is no "issue" as PDFsharp is working as intended.

Feel free to implement this and give us a PR.

See also:
https://github.com/empira/PDFsharp/issu ... 2038108463

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