posts - 198,  comments - 1481,  trackbacks - 6
using System;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
public class fdf_write
{
    [STAThread]
    
public static void  Main(string[] cword)
    {
        
try
        {
            FdfWriter fdf 
= new FdfWriter();            
            fdf.SetFieldAsString(
"First Name""Paulo");
            fdf.SetFieldAsString(
"Last Name""Soares");
            fdf.SetFieldAsString(
"itext.Task.1""Release source");
            fdf.SetFieldAsString(
"itext.Task.2""Release jar");
            fdf.SetFieldAsString(
"itext.Release""itext-paulo-111");
            fdf.File
=("fdf_write.Pdf");
            fdf.WriteTo(
new FileStream(@"E:\java\fdf_write.Fdf", FileMode.Create));
            System.Console.Out.WriteLine(
"Finished.");
        }
        
catch (System.Exception e)
        {
            System.Console.Error.WriteLine(e.Message);
        }
    }

    
public static void Pdf2Fdf(string[] args)
    {
        PdfReader pdf 
= new PdfReader(@"e:\java\form_text.Pdf");
        FdfWriter fdf 
= new FdfWriter();
        fdf.SetFields(pdf.AcroFields);
        fdf.File
=("fdf_write.pdf");
        fdf.WriteTo(
new FileStream(@"E:\java\fdf_write1.Fdf", FileMode.Create));

    }
}
posted on 2006-07-20 10:56 RubyPDF 阅读(...) 评论(...) 编辑 收藏