当前位置: 首页>>代码示例>>C#>>正文


C# iTextSharp.Close方法代码示例

本文整理汇总了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();
        }
开发者ID:stuartmayhew,项目名称:dist23mvc,代码行数:85,代码来源:PrintMeetingHelper.cs

示例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();
     }
 }
开发者ID:stuartmayhew,项目名称:dist23mvc,代码行数:21,代码来源:PrintMeetingHelper.cs


注:本文中的iTextSharp.Close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。