Hello everyone,
I'm trying to use Aspose.Pdf to open a PDF form, update a field, and then save a PDF form, while still keeping the form editable.
This works using Adobe Reader with my sample PDF form, I can open the form, update a field, save the form, reopen the form, and everything works as expected, the value that I updated has been saved and the form is still editable.
I can't get this to work with Aspose.Pdf using the sample code from the "Preserve Extended Rights When Working With Forms" page. In code I can open the form, update a field, and save the form, but when I open it again in Adobe Reader I find that it's now not editable (but the field has at least been updated).
I'm using a trial version of Aspose.Pdf for .NET with the full version Visual Studio 2013 Pro on Windows 8.1 Pro.
// code snippet begins
const string ORIGINAL_PDF_FILE_NAME = "MyFilename.pdf";
string pdfFilesRootFolderPath = Path.GetFullPath(@"..\..\PdfForms");
string inputPdf = Path.Combine(pdfFilesRootFolderPath, ORIGINAL_PDF_FILE_NAME);
FileStream fs = new FileStream(inputPdf, FileMode.Open, FileAccess.ReadWrite);
Document pdfDocument = new Document(fs);
foreach (Field formField in pdfDocument.Form)
{
if (formField.FullName.Contains("Policy/Contract"))
{
TextBoxField textBoxField = formField as TextBoxField;
textBoxField.Value = "Testing";
}
}
pdfDocument.Save();
fs.Close();
// code snippet ends
Any help will be greatly appreciated.
Ciao,
Michael