zoukankan      html  css  js  c++  java
  • C# 对PDF文件的使用

    百度网盘三方dll

    ps:. net framework 4.0 client profile 下不行

    using Spire.Pdf;
    using Spire.Pdf.Graphics;
    using System.Diagnostics;
    
                PdfDocument doc = new PdfDocument();
                doc.PageSettings.Margins.All = 0;//设置边距为0
                PdfPageBase page = doc.Pages.Add();
                doc.Pages.RemoveAt(0);//删除第一页,因为有水印
    
                page = doc.Pages.Add();
                PdfTrueTypeFont trueTypeFont16 = new PdfTrueTypeFont(new System.Drawing.Font("宋体", 28, FontStyle.Regular), true);
    
                //字体颜色
                PdfSolidBrush brushGray = new PdfSolidBrush(Color.Gray);
                PdfSolidBrush brushBlack = new PdfSolidBrush(Color.Black);
    
                //直线颜色
                PdfPen pdfPenBlack = new PdfPen(Color.Black);
                PdfPen pdfPenGray = new PdfPen(Color.Gray);
    
                PdfImage pimg = PdfImage.FromImage(Properties.Resources.image1);
    
                page.Canvas.DrawImage(pimg, 100, 200, 20, 100, 50);
                page.Canvas.DrawString("Hello world!", trueTypeFont16, brushBlack, 200, 100);
                page.Canvas.DrawLine(pdfPenGray, 50, 200, 500, 200);
    
                string name = DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".pdf";
                doc.SaveToFile(name);
                doc.Close();
                Process.Start(name);
  • 相关阅读:
    51nod1278 相离的圆
    CodeForces
    SPOJ
    51nod 1040(欧拉函数)
    51nod1009 51nod1042(数位dp)
    51nod1264 线段相交
    51nod1050 循环数组最大子段和
    Spark SQL UDF示例
    Spark SQL官网阅读笔记
    Spark RDD
  • 原文地址:https://www.cnblogs.com/bridgew/p/12709091.html
Copyright © 2011-2022 走看看