Hi there, I am having a problem with the PDF program that I am currently writing. If I try to merge two PDFs that happen to use the same AcroField names, then the Fields in the 2nd PDF will simply become blank. I am currently using the following method to 'flatten' the PDFs:
Code:
if (Flatten) {
PdfAcroField.PdfAcroFieldCollection fields = inForm.Fields;
string[] names = fields.Names;
for (int idx = 0; idx < names.Length; ++idx)
{
string fqName = names[idx];
PdfAcroField field = fields[fqName];
PdfTextField textField;
if ((textField = field as PdfTextField) != null)
{
textField.ReadOnly = true;
}
}
}
This works fine, in that it makes the Fields unable to be edited in Acrobat Reader. However it seems that the forms still exist as they can be edited in Adobe Acrobat, or by loading the PDF again with PDFSharp. I'd seen that a solution was in the works here:
viewtopic.php?f=2&t=3369 but this doesn't seem to have made it over to the 1.50.4000-Beta3B release yet. I tried following the patch tutorial, but the Source Code would not build after I tried it. Is there any way to completely flatten the AcroFields at this time?
Alternatively I had another idea to solve the problem in the meantime. I could rename all of the fields present in the PDF to some randomly generated 16 character name, like "ALVDrrLAWUawTxUh" or "ZDJrQdfwGLL3DDz5". This would mean that any PDF saved by my program would be extremely unlikely to ever have the same Field names, meaning that they would not overwrite each other. Is it possible to rename an AcroField?
Thanks, RBrNx