Loading
posts - 201,  comments - 1457,  trackbacks - 6
有人需要就贴了出来了,这个系列的100多个demo去年已经翻译完毕,一直想不出有什么必要放出来,搁置半年了。
using System;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
public class form_checkbox
{
    
    
    [STAThread]
    
public static void  Main(string[] args)
    
{
        Document document 
= new Document(PageSize.A4, 50505050);
        
try
        
{
            
// creation of the different writers
            PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(@"e:\java\form_checkbox.Pdf", FileMode.Create));
            
            document.Open();
            PdfContentByte cb 
= writer.DirectContent;
            cb.MoveTo(
00);
            PdfFormField field 
= PdfFormField.CreateCheckBox(writer);
            PdfAppearance tpOff 
= cb.CreateAppearance(2020);
            PdfAppearance tpOn 
= cb.CreateAppearance(2020);
            tpOff.Rectangle(
111818);
            tpOff.Stroke();
            
            tpOn.SetRGBColorFill(
255128128);
            tpOn.Rectangle(
111818);
            tpOn.FillStroke();
            tpOn.MoveTo(
11);
            tpOn.LineTo(
1919);
            tpOn.MoveTo(
119);
            tpOn.LineTo(
191);
            tpOn.Stroke();
            
            field.SetWidget(
new Rectangle(100700120720), PdfAnnotation.HIGHLIGHT_INVERT);
            field.FieldName
=("Urgent");
            field.ValueAsName
=("Off");
            field.AppearanceState
=("Off");
            field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, 
"Off", tpOff);
            field.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, 
"On", tpOn);
            writer.AddAnnotation(field);
            document.Close();
            System.Console.Out.WriteLine(
"FIM.");
        }

        
catch (System.Exception de)
        
{
            System.Console.Error.WriteLine(de.Message);
        }

    }

}
0
0
(请您对文章做出评价)
« 上一篇:pdfselect:随意抽取,排序你的PDF(免费,免Acrobat,Console)
» 下一篇:ZedGraph:一个同时支持WinForm和WebForm的开源图表控件(基于LGPL协议,.NET 2.0 C#源代码)
posted on 2006-05-02 09:22 RubyPDF 阅读(2236) 评论(0)  编辑 收藏 网摘 所属分类: iTextSharp(iText#)
<2006年5月>
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

最新闪存

常用链接

我参与的团队

我的标签

随笔分类(177)

PDF

最新随笔

积分与排名

  • 积分 - 492263
  • 排名 - 74

最新评论

阅读排行榜

评论排行榜