using System;
using System.IO;using iTextSharp.text;
using iTextSharp.text.pdf;namespace Chap0101
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
// step 1: creation of a document-object
Document document = new Document(PageSize.A4.rotate());
//Document document = new Document(PageSize.B5.rotate()); try
{
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter writer = PdfWriter.getInstance(document, new FileStream("d:\\Chap0101.pdf", FileMode.Create));
writer.setEncryption(PdfWriter.STRENGTH128BITS, "111", "6452116",
/*PdfWriter.AllowCopy | */PdfWriter.AllowPrinting); // we add some metadata and open the document
document.addTitle("pdf测试");
document.addAuthor("张立华");
document.addKeywords("world"); // we Add a Water that will show up on PAGE 1
try
{
Water water = new Water(Image.getInstance("water.jpg"),200, 300);
document.Add(water);
}
catch
{
Console.Error.WriteLine("Are you sure you have the file 'water.jpg' in the right path?");
} // we Add a Header that will show up on PAGE 1
HeaderFooter header = new HeaderFooter(new Phrase("hehe小"), false);
document.Header = header;
// step 3: we open the document
document.Open();
// step 4: we Add a paragraph to the document
// step 4: we Add some paragraphs to the document
for (int i = 0; i < 5; i++)
{
document.Add(new Paragraph("Hello World呵呵"));
}
}
catch(DocumentException de)
{
Console.Error.WriteLine(de.Message);
}
catch(IOException ioe)
{
Console.Error.WriteLine(ioe.Message);
} // step 5: we close the document
if (document.isOpen())
document.Close(); }
}
}我的所有的 呵呵 汉字都没有了
using System.IO;using iTextSharp.text;
using iTextSharp.text.pdf;namespace Chap0101
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
// step 1: creation of a document-object
Document document = new Document(PageSize.A4.rotate());
//Document document = new Document(PageSize.B5.rotate()); try
{
// step 2:
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter writer = PdfWriter.getInstance(document, new FileStream("d:\\Chap0101.pdf", FileMode.Create));
writer.setEncryption(PdfWriter.STRENGTH128BITS, "111", "6452116",
/*PdfWriter.AllowCopy | */PdfWriter.AllowPrinting); // we add some metadata and open the document
document.addTitle("pdf测试");
document.addAuthor("张立华");
document.addKeywords("world"); // we Add a Water that will show up on PAGE 1
try
{
Water water = new Water(Image.getInstance("water.jpg"),200, 300);
document.Add(water);
}
catch
{
Console.Error.WriteLine("Are you sure you have the file 'water.jpg' in the right path?");
} // we Add a Header that will show up on PAGE 1
HeaderFooter header = new HeaderFooter(new Phrase("hehe小"), false);
document.Header = header;
// step 3: we open the document
document.Open();
// step 4: we Add a paragraph to the document
// step 4: we Add some paragraphs to the document
for (int i = 0; i < 5; i++)
{
document.Add(new Paragraph("Hello World呵呵"));
}
}
catch(DocumentException de)
{
Console.Error.WriteLine(de.Message);
}
catch(IOException ioe)
{
Console.Error.WriteLine(ioe.Message);
} // step 5: we close the document
if (document.isOpen())
document.Close(); }
}
}我的所有的 呵呵 汉字都没有了
解决方案 »
- storyboard创建动画问题
- 控件的列标头名称能换行吗?
- 默认按钮 第一个按钮太霸道 windows程序
- vs 2003 能否安装.net framework 2.0?
- 简单问题散分!~~!~!~!
- datagrid问题:如何自动展开datagrid中的多表?不想有+号
- Varbinary字段数据转换问题求教...
- WINFORM界面加载慢,控件底色从透明或黑色再呈现控件,求解决方案
- 请教,我的visual studio.net的起始页里怎么。。。。
- 问个水晶报表的简单问题,同志们帮忙!!
- Access数据库密码问题
- 一个datagrid ,里边的customer 列需要弹出一个窗口来选择,并填回去
document.addTitle("pdf测试");
document.addAuthor("张立华");
document.addKeywords("world");
上面三行是正确的默认字体好像是Helvetica
BaseFont bfSONG = BaseFont.createFont(Server.MapPath("Font/SURSONG.TTF"), BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
收分幺