Last post Jun 28, 2011 10:34 AM by machanian
Aug 18, 2010 04:06 PM|Alex_808|LINK
Hello I have a pdf template with a form with the Extended features enable. After filling in the fields of this form using iTextSharp, a user with acrobat reader gets the error message:
"This document enabled extended features in Adobe Reader. The document hasbeen changed since it was created and use of extended features is no longeravailable. Please contact the author for the original version of thisdocument."I have been looking for a solutions and saw a couple posts on the subject so...Is there a way to keep the extended features enabled and modifying the pdf with iTextSharp ?
Aug 24, 2010 02:32 AM|kuujinbo|LINK
There was a recent update in SVN that may solve your problem:
You need you download and build the solution.
http://kuujinbo.info/ | HTTP 301
Aug 26, 2010 10:00 AM|Alex_808|LINK
I still have the same problem
Aug 26, 2010 10:22 AM|kuujinbo|LINK
 did you build the source from trunk?
 are you properly using append mode?
PdfStamper ps = new PdfStamper(pr, fs, '\0', true);
pr => PdfReader object w/form
fs => Stream object for output file
Aug 26, 2010 11:14 AM|Alex_808|LINK
Sir, i love you. (hade to specified append to true)
Oct 19, 2010 01:00 PM|rajeev2012|LINK
I am having the same issue and have used the same suggested code, please see below, yet the problem persists...
PdfReader pr = new PdfReader(iFile);
System.IO.FileStream fs = new FileStream(oFile, System.IO.FileMode.CreateNew, FileAccess.ReadWrite);
PdfStamper ps = new PdfStamper(pr, fs, '\0', true);
AcroFields pf = ps.AcroFields;
Your help is appreciated ...
Oct 21, 2010 03:53 PM|Alex_808|LINK
Hello, i can give you the code i used
pdfTemplate = "\\template_evalform\EvaluationForm.pdf"
Dim newFile As String = "\\cdpharma-svr\www\vvp\media\_temp\" & test & "-Eval.pdf"
Dim pdfReader As New PdfReader(pdfTemplate)
Dim pdfStamper As New PdfStamper(pdfReader, New FileStream(newFile, FileMode.Create), "\0", True)
Dim pdfFormFields As AcroFields = pdfStamper.AcroFields
pdfFormFields.SetField("field_name", "bla bla bla")
pdfStamper.Close() 'did you try closing it?
Oct 22, 2010 12:50 AM|rajeev2012|LINK
I have used the same code as well I am closing Filstream as well as pdfstamper. But, no luck ...
I have also tried to fill it through XML data (xfa.fill) but that fails, too.
Nov 13, 2010 05:30 PM|B List|LINK
I just had to say that I love you too.
Adding append=true fixed my problem. That also required me to set ps.FormFlattening = false. (which is fine)
Jan 18, 2011 07:49 PM|hugofloresgomez|LINK
Im not able to make the PDF extended features to work. Im following your recomendations :S
Dim fs As New IO.FileStream(fileName, IO.FileMode.Create)
Dim pdf As New PdfReader(templateName)
Dim pdfStm As New PdfStamper(pdf, fs, "\0", True)
Dim fields As AcroFields = pdfStm.AcroFields
pdfStm.FormFlattening = False
Im using iTextSharp v 22.214.171.124 .... any help???
Jun 22, 2011 01:46 PM|JIV|LINK
It is working for me with iTextSharp 126.96.36.199. Thanks to this thread for the solution!
Jun 28, 2011 10:34 AM|machanian|LINK
I'm using Itextsharp v5.05 and created enabled reader pdf files. I wrote a c# class that fill the form and keep each individual pdf file extended reader. But, when I use this MergeFiles function here it create a new Merged file NOT extended reader and I
need your help with this please ...
my MergeFiles function is :
public static void MergeFiles(string destinationFile, string sourceFiles)
//1: Create the MemoryStream for the destination document.
using (MemoryStream ms = new MemoryStream())
//2: Create the PdfCopyFields object.
PdfCopyFields copy = new PdfCopyFields(ms);
// - Set the security and other settings for the destination file.
//copy.Writer.SetEncryption(PdfWriter.STRENGTH128BITS, null, "1234", PdfWriter.AllowPrinting | PdfWriter.AllowCopy | PdfWriter.AllowFillIn);
copy.Writer.ViewerPreferences = PdfWriter.PageModeUseOutlines;
// - Create an arraylist to hold bookmarks for later use.
ArrayList outlines = new ArrayList();
int pageOffset = 0;
int f = 0;
//3: Import the documents specified in args, args, etc...
while (f < sourceFiles.Length)
// Grab the file from args and open it with PdfReader.
string file = sourceFiles[f];
PdfReader reader = new PdfReader(file, PdfEncodings.ConvertToBytes("1234", null));
// PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(newFile, FileMode.Create), '\0', true);
// Import the pages from the current file.
// Create an ArrayList of bookmarks in the file being imported.
// ArrayList bookmarkLst = SimpleBookmark.GetBookmark(reader);
// Shift the pages to accomidate any pages that were imported before the current document.
// SimpleBookmark.ShiftPageNumbers(bookmarkLst, pageOffset, null);
// Fill the outlines ArrayList with each bookmark as a HashTable.
// foreach (Hashtable ht in bookmarkLst)
// Set the page offset to the last page imported.
pageOffset += reader.NumberOfPages;
//4: Put the outlines from all documents under a new "Root" outline and
// set them for destination document
// copy.Writer.Outlines = GetBookmarks("Root", ((Hashtable)outlines)["Page"], outlines);
//5: Close the PdfCopyFields object.
//6: Save the MemoryStream to a file.
catch (System.Exception e)
/// Saves a MemoryStream to the specified file name
/// <param name="MS">MemoryStream to save</param>
/// <param name="FileName">File name to save MemoryStream as</param>
public static void MemoryStreamToFile(MemoryStream MS, string FileName)
using (FileStream fs = new FileStream(@FileName, FileMode.Create))
byte data = MS.ToArray();
fs.Write(data, 0, data.Length);