Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
#1 Posted : Friday, September 11, 2020 3:16:31 AM(UTC)

Rank: Member

Groups: Registered
Joined: 5/9/2019(UTC)
Posts: 24
Location: Sydney

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:
public IPdfField SetValue(object value)
	Field.Value = null;

	if (value != null)
		switch (value)
			case string stringValue:
					Field.Value = value.ToString();



	return this;

Edited by moderator Tuesday, September 15, 2020 6:14:17 AM(UTC)  | Reason: Not specified

Paul Rayman  
#2 Posted : Tuesday, September 15, 2020 6:09:53 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 909

Thanks: 3 times
Was thanked: 110 time(s) in 107 post(s)
Try this
Pdfium.FPDFOBJ_SetIsModified(field.Dictionary.Handle, true);

or even this

    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 6:12:15 AM(UTC)  | Reason: Not specified

Users browsing this topic
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.