PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 12:41 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu Feb 29, 2024 10:06 am 
Offline

Joined: Thu Feb 29, 2024 7:48 am
Posts: 4
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


Top
 Profile  
Reply with quote  
PostPosted: Fri Mar 01, 2024 6:03 pm 
Offline

Joined: Fri Mar 01, 2024 5:57 pm
Posts: 4
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.


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 04, 2024 5:59 am 
Offline

Joined: Thu Feb 29, 2024 7:48 am
Posts: 4
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.


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 04, 2024 12:57 pm 
Offline

Joined: Fri Mar 01, 2024 5:57 pm
Posts: 4
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.


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 05, 2024 2:12 pm 
Offline

Joined: Thu Feb 29, 2024 7:48 am
Posts: 4
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.


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 19, 2024 11:32 am 
Offline

Joined: Thu Feb 29, 2024 7:48 am
Posts: 4
Hi Team,
Can someone help in here please?


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 19, 2024 2:08 pm 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 916
Location: CCAA
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

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 362 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group