zoukankan      html  css  js  c++  java
  • iTextCharp c#

    //引用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, 10));
    
                //表格
                //传入列数
                //也可传入表示每一列宽度的float[]
                var table = new PdfPTable(3);
                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();
            }
  • 相关阅读:
    NSArray block用法
    Be JSON (Just Make JSON Easy!) 什么是JSON
    swift循环
    swift学习网站
    利用正则表达式解析URL
    水果瀑布流布局
    iOS文件操作
    PHP HTTP协议:防盗链
    PHP HTTP协议(报头/状态码/缓存)
    PHP 基础知识代码总结
  • 原文地址:https://www.cnblogs.com/ives/p/10623227.html
Copyright © 2011-2022 走看看