Using asp.net with C# Codebehind and iTextSharp library.
I have a pdf form that I created in LiveCycle, that has text fields and a barcode (code 3 of 9). I use this template to create packing slips. When I run my code, I pull values out of the database and plug them into the text boxes and change the number value for the barcode. In order for the values to show up on the completed pdf, I have to flatten the pdf. It seems that when the pdf is flattened, I lose the barcode image. All that shows is the number that I set.
Does anyone have any Idea how to retain the barcode image when I flatten my pdf?
Here is a snippet of my code.
PdfReader pdfReader = new PdfReader(_pdfFullFilename);
PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(pdfTemplate, FileMode.Create));
AcroFields pdfFormFields = pdfStamper.AcroFields;
//...
foreach (string fieldKey in pdfFormFields.Fields.Keys)
{
if (fieldKey.Contains("BarCode[0]"))
pdfFormFields.SetField(fieldKey, _productNumber);
}
//...
pdfStamper.FormFlattening = true;
pdfStamper.Close();
pdfReader.Close();
Any Help would be much appreciated. Let me know if I need to expound on anything.