Rank: Member
Groups: Registered
Joined: 5/9/2019(UTC) Posts: 25  Location: Sydney Thanks: 1 times Was thanked: 1 time(s) in 1 post(s)
|
Hi Paul, I'm having an issue where field values that are added through code (when our documents are automated) are not being saved. If a value is entered manually it is saved correctly. I've narrowed the issue down to the SaveFlag. With NoIncremental it works and with Incremental it does not. My colleague raised this same issue two years ago - https://forum.patagames.com/posts/t462-Save-and-Save-field-values-not-working.Previously all our PDF documents have been saved with the NoIncremental flag. However, we have a new type of form which will need to be filled out by many end users. As such, we absolutely don't want the digital signature corruption issue (https://forum.patagames.com/posts/t491-Error-message-opening-saved-document-Acrobat-reader) that occurs when saving with NoIncrement and subsequently opening in Adobe Reader. Any idea why this happens when you save incrementally? Or is there a workaround you could suggest? Here's how we're setting the values through code: Code:public IPdfField SetValue(object value)
{
Field.Value = null;
Field.ClearSelection();
if (value != null)
{
switch (value)
{
case string stringValue:
{
Field.Value = value.ToString();
}
break;
...
}
}
...
return this;
}
Edited by moderator Tuesday, September 15, 2020 3:14:17 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Try this Code:Pdfium.FPDFOBJ_SetIsModified(field.Dictionary.Handle, true);
or even this Code: field.Value = "test value";
foreach (var ctrl in field.Controls)
{
Pdfium.FPDFOBJ_SetIsModified(ctrl.Dictionary.Handle, true);
IntPtr normalAppearanceStream = Pdfium.FPDFAnnot_GetAppearanceStream(ctrl.Dictionary.Handle, AppearanceStreamModes.Normal);
Pdfium.FPDFOBJ_SetIsModified(normalAppearanceStream, true);
}
doc.Save(@"e:\35\signed_changed.pdf", SaveFlags.Incremental);
If that doesn't help you, please provide a PDF document and a simple console application. I will check it on my part. Edited by user Tuesday, September 15, 2020 3:12:15 AM(UTC)
| Reason: Not specified
|
 1 user thanked Paul Rayman for this useful post.
|
|
|
|
Rank: Member
Groups: Registered
Joined: 5/9/2019(UTC) Posts: 25  Location: Sydney Thanks: 1 times Was thanked: 1 time(s) in 1 post(s)
|
Thanks Paul, you've done it again!
For those playing at home, I had to use the second option.
|
|
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close