iTextCharp c#
2024-09-04 00:18:43
//引用iTextSharp
static void testPdf()
{
var document = new Document();
var writer = PdfWriter.GetInstance(document, new FileStream("./test.pdf",FileMode.Create));
document.Open(); //最小元素
document.Add(new Chunk("Chunk")); //段落
document.Add(new Paragraph("Paragraph")); //短语
document.Add(new Phrase("Phrase")); //list
//是否有编号,是否使用字母进行编号,列表缩进量
document.Add(new List(true, false, )); //表格
//传入列数
//也可传入表示每一列宽度的float[]
var table = new PdfPTable();
var cell = new PdfPCell(new Phrase("cell"));
cell.BorderColor=BaseColor.BLUE;
table.AddCell(cell);
table.AddCell(cell);
table.AddCell(cell);
table.AddCell(cell);
table.AddCell(cell);
table.AddCell(cell);
table.AddCell(cell);
table.AddCell(cell);
table.AddCell(cell);
document.Add(table); var imgUri = new Uri("https://ss0.bdstatic.com/5aV1bjqh_Q23odCf/static/superman/img/logo_top_86d58ae1.png");
var img = Image.GetInstance(imgUri);
document.Add(img);
document.Close();
}
最新文章
- IOS开发基础知识--碎片44
- c# BlowFish 高速 对称加密
- 小白科普之JavaScript的数组
- ****Web API 版本控制的几种方式
- Linux 套接字编程中要注意的细节
- 刷入临时recovery
- PHP 获得当前页面所有变量常量的值
- opencv配置
- HTML5特性之AJAX跨域
- sbb指令
- Android应用开发-网络编程(二)
- 设计模式《JAVA与模式》之访问者模式
- 关于animation的一些简单基础和使用方法记载
- android listView 点两下才监听到
- P2008 大朋友的数字
- PHP面试题一
- cocos2d-x开发记录:二,基本概念(动作,动画,坐标系统)
- JAVA-用HttpClient来模拟浏览器GET,POST
- C的动态链表建立
- RandomUser 网站介绍