Hi,
i am using a PDF merger for the following code.
string formPath = ConfigurationSettings.AppSettings["PDFTemplate"];
PdfDocument pdfDoc = new PdfDocument(@formPath);
MergeDocument document = new MergeDocument(pdfDoc);
MergeOptions options = new MergeOptions(true,j.ToString());
document.Append(pdfDoc, options);
foreach (DataRow _dr in foundRows)
{
fld1= _dr["street1"].ToString();
fld2= _dr["street2"].ToString();
fld3= _dr["city"].ToString();
fld4= _dr["State"].ToString();
fld5= _dr["Zip"].ToString();
document.Form.Fields["street1"].Value = fld1;
document.Form.Fields["street2"].Value = fld2;
document.Form.Fields["city].Value = fld3;
document.Form.Fields["state"].Value = fld4;
document.Form.Fields["Zip"].Value = fld5;
}
I want to display the form field for street2 only when some data is there. In other words if there is no data for "fld2" i dont want to display the field on my PDF form. But i also don't want the empty space for the "street2" field on the PDF form.
I want the address as :
729B Cross Road - street1
Edison - city
NJ - state
08830 - Zip
and not as:
729B Cross Road - street1
- street2
Edison - city
NJ - state
08830 - Zip
HOw can I achieve this as street2 is already defined in the PDF template?