Field are removed or inaccessible after a Save pdfDocument

Hi,

When I replace the value of the fields in my file.pdf, and call the save function, the fields in the out.pdf are no more accessible. I ve got a message from adobe reader : “This document enabled extended features in Adobe Reader. The document has been changed since it was created and use of extended features is no longer available”. What can I do?

Thanks
code >>>

public FileContentResult pdfForm(maFolder folder, Dictionary<string, decimal> aValues, string file)
{
Dictionary<string, string> aFields = null;
byte[] result = null;

try
{
Aspose.Pdf.License license = new Aspose.Pdf.License();
license.SetLicense(Server.MapPath("~/App_Data/Aspose.Pdf.lic"));

//open document
var pdfDocument = new Document(Server.MapPath("~/App_Data/Compta/" + file + “.pdf”));

//get values from all fields
foreach (Field formField in pdfDocument.Form)
{
if (aValues.ContainsKey(formField.FullName))
{
TextBoxField textBoxField = formField as TextBoxField;
//modify field value
textBoxField.Value = aValues[formField.FullName].ToString(“N0”);
}
}

//generate new Pdf file output stream.
MemoryStream outStream = new MemoryStream();
pdfDocument.Save(outStream);

result = outStream.ToArray();
// close the output stream
outStream.Close();
}
catch (Exception e)
{
throw e;
}

return File(result, “application/pdf”, string.Format("{0}.pdf", file));
}

Hi Olivier,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template file and sample code.

I tried to replicate your issue with the latest version of Aspose.Pdf for .NET v6.9 and I am unable to reproduce your mentioned issue. As your shared code sample is missing some variables values, I used the following code and attached the generated file for your reference which is still editable after filling the data.

//open
document<o:p></o:p>


var
pdfDocument = new Document(“E:\fichedescriptiveformulaire_6981-before.pdf”);<o:p></o:p>

//get
values from all fields<o:p></o:p>

foreach (Field formField in
pdfDocument.Form)<o:p></o:p>

{<o:p></o:p>

if
(formField.FullName.Contains(“A1”))<o:p></o:p>

{<o:p></o:p>

TextBoxField
textBoxField = formField as TextBoxField;<o:p></o:p>

//modify
field value<o:p></o:p>

textBoxField.Value = “Testing”;<o:p></o:p>

}<o:p></o:p>

}<o:p></o:p>

<o:p></o:p>

pdfDocument.Save(“E:\fichedescriptiveformulaire_6981-after.pdf”);

Please try the latest version and if you still face any
issue, please create a sample application and share it with us to show the
issue. We will check it and get back to you soon.<o:p></o:p>

Sorry for the inconvenience,

Hi,

I have the same problem. After filling in the fields when opening documents a message "This document enabled extended features in Adobe Reader. The document has been changed since it was created and use of extended features is no longer available". File with the last message fichedescriptiveformulaire_6981-after.pdf also opens with the same message. What should be done to avoid and fields can be edited in Adobe Reader ?

Version 7.0.0.0

Hi Iurii,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.Pdf for .NET.

After further testing, I am able to generate your mentioned issue with Aspose.Pdf for .NET v7.0. I have registered the issue in our issue tracking system with issue id: PDFNEWNET-33750. You will be notified via this forum thread regarding any updates against this issue.

Sorry for the inconvenience,

If in the constructor to use the input and output file is the same, then the file opens without any problems. If the files are different there is a problem.

Form frm = new Form(doc, doc);

foreach (string field in fields)

{
frm.FillField(field, field);
}

frm.Save();


That's works

Hi Iurii,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the feedback.

I have shared this information with the development team and hopefully this will help us narrow down the issue in case we have different files.

Sorry for the inconvenience,

I hadn’t the time to wait for this fix, so I didn’t use anymore your pdf component. So take your time…

Hi Olivier,


Thanks for your patience.

Our development team is working hard but due to some technical difficulties, the problem is not yet resolved. However I have requested the team to share the ETA regarding its resolution. Please be patient and spare us little time. We are sorry for this inconvenience.

Hi,


Thanks for your patience.

Please note that in order to avoid loosing the extended rights feature in PDF form, please follow the steps shared over Preserve Extended Rights feature while working with Forms

In case you still face the same problem or you have any further query, please feel free to contact. We are sorry for your inconvenience.

The issues you have found earlier (filed as PDFNEWNET-33750) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

I am using version 7.4 and still get the same problem.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.Pdf.

I checked the issue with the latest version of Aspose.Pdf for .NET v7.4 and I am unable to reproduce the problem. Following is my test code.

FileStream fs = new FileStream(@"D:\Test.pdf", FileMode.Open, FileAccess.ReadWrite);

//open document

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(fs);

//get values from all fields

foreach (Field formField in pdfDocument.Form)

{

if (formField.FullName.Contains("A1"))

{

TextBoxField textBoxField = formField as TextBoxField;

//modify field value

textBoxField.Value = "Testing";

}

}

pdfDocument.Save();

fs.Close();

In order to preserve the Extended Rights, please use the Incremental approach. Using this approach, you will need to open the source file in Stream object (with ReadWrite File Access), perform required operation and call Document.Save(..) method with no argument. It will save the updated document in same original Stream. Please see the following documentation link for more details.

Preserve Extended Rights feature while working with Forms

In case you still face any issue or have any confusion, please share your template PDF file and sample code so we can test the issue at our end.

Sorry for the inconvenience,

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan