本文整理汇总了C#中iTextSharp.Close方法的典型用法代码示例。如果您正苦于以下问题:C# iTextSharp.Close方法的具体用法?C# iTextSharp.Close怎么用?C# iTextSharp.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类iTextSharp
的用法示例。
在下文中一共展示了iTextSharp.Close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addFields
private static void addFields(iTextSharp.text.pdf.PdfReader reader, FileStream fs, SqlDataReader dr)
{
using (var pdfStamper = new PdfStamper(reader, fs))
{
int i = 0;
int fieldIndex = 0;
int page = 1;
int top;
int bottom;
while (dr.Read())
{
if (i > 22 && page == 1)
{
page = 2;
i = 1;
}
i++;
fieldIndex++;
int lineSp = (i - 1) * 20;
if (page == 1)
{
top = 450 - lineSp;
bottom = 470 - lineSp;
}
else
{
top = 600 - lineSp;
bottom = 620 - lineSp;
}
iTextSharp.text.BaseColor currBackgrd;
if (i % 2 == 0)
currBackgrd = iTextSharp.text.BaseColor.WHITE;
else
currBackgrd = iTextSharp.text.BaseColor.LIGHT_GRAY;
TextField field = new TextField(pdfStamper.Writer, new iTextSharp.text.Rectangle(20, top, 90, bottom), "Day" + fieldIndex.ToString());
field.FontSize = MYSIZE;
field.Rotation = 90;
field.BackgroundColor = currBackgrd;
pdfStamper.AddAnnotation(field.GetTextField(), page);
field = new TextField(pdfStamper.Writer, new iTextSharp.text.Rectangle(92, top, 145, bottom), "Time" + fieldIndex.ToString());
field.FontSize = MYSIZE;
field.Rotation = 90;
field.BackgroundColor = currBackgrd;
pdfStamper.AddAnnotation(field.GetTextField(), page);
field = new TextField(pdfStamper.Writer, new iTextSharp.text.Rectangle(147, top, 197, bottom), "Type" + fieldIndex.ToString());
field.FontSize = MYSIZE;
field.Rotation = 90;
field.BackgroundColor = currBackgrd;
pdfStamper.AddAnnotation(field.GetTextField(), page);
field = new TextField(pdfStamper.Writer, new iTextSharp.text.Rectangle(199, top, 309, bottom), "Topic" + fieldIndex.ToString());
field.FontSize = MYSIZE;
field.Rotation = 90;
field.BackgroundColor = currBackgrd;
pdfStamper.AddAnnotation(field.GetTextField(), page);
field = new TextField(pdfStamper.Writer, new iTextSharp.text.Rectangle(311, top, 461, bottom), "aaGroup" + fieldIndex.ToString());
field.FontSize = MYSIZE;
field.Rotation = 90;
field.BackgroundColor = currBackgrd;
pdfStamper.AddAnnotation(field.GetTextField(), page);
field = new TextField(pdfStamper.Writer, new iTextSharp.text.Rectangle(463, top, 690, bottom), "Location" + fieldIndex.ToString());
field.FontSize = MYSIZE;
field.Rotation = 90;
field.BackgroundColor = currBackgrd;
pdfStamper.AddAnnotation(field.GetTextField(), page);
field = new TextField(pdfStamper.Writer, new iTextSharp.text.Rectangle(692, top, 782, bottom), "City" + fieldIndex.ToString());
field.FontSize = MYSIZE;
field.Rotation = 90;
field.BackgroundColor = currBackgrd;
pdfStamper.AddAnnotation(field.GetTextField(), page);
}
pdfStamper.FormFlattening = true;
pdfStamper.Close();
reader.Close();
}
fs.Close();
}
示例2: fillFormFields
private static void fillFormFields(iTextSharp.text.pdf.PdfReader reader, FileStream fs, SqlDataReader dr)
{
using (var pdfStamper = new PdfStamper(reader, fs))
{
int i = 0;
while (dr.Read())
{
i++;
pdfStamper.AcroFields.SetField("Day" + i.ToString(), FormatField(dr["Day"].ToString(), "Day"));
pdfStamper.AcroFields.SetField("Time" + i.ToString(), FormatField(dr["Time"].ToString(), "Time"));
pdfStamper.AcroFields.SetField("Type" + i.ToString(), FormatField(dr["Type"].ToString(), "Type"));
pdfStamper.AcroFields.SetField("Topic" + i.ToString(), FormatField(dr["Topic"].ToString(), "Topic"));
pdfStamper.AcroFields.SetField("Group" + i.ToString(), FormatField(dr["aaGroup"].ToString(), "aaGroup"));
pdfStamper.AcroFields.SetField("Location" + i.ToString(), FormatField(dr["Location"].ToString(), "Location"));
pdfStamper.AcroFields.SetField("City" + i.ToString(), FormatField(dr["City"].ToString(), "City"));
}
pdfStamper.FormFlattening = true;
pdfStamper.Close();
reader.Close();
}
}