zoukankan      html  css  js  c++  java
  • 开源项目 04 PdfSharp

    using PdfSharp.Drawing;
    using PdfSharp.Pdf;
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ConsoleApp2.test1
    {
        public class Class4
        {
            //原文:http://www.pdfsharp.net/wiki/PDFsharpSamples.ashx?AspxAutoDetectCookieSupport=1
    
            public void test1()
            {
                // Create a new PDF document
                PdfDocument document = new PdfDocument();
                document.Info.Title = "Created with PDFsharp";
    
                // Create an empty page
                PdfPage page = document.AddPage();
    
                // Get an XGraphics object for drawing
                XGraphics gfx = XGraphics.FromPdfPage(page);
    
                // Create a font
                XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);
    
                // Draw the text
                gfx.DrawString("Hello, World!", font, XBrushes.Black,
                  new XRect(0, 0, page.Width, page.Height),
                  XStringFormats.Center);
    
                // Save the document...
                const string filename = "HelloWorld.pdf";
                document.Save(filename);
    
    
                // ...and start a viewer.
                //Process.Start(filename);
            }
        }
    
    
    
    }
  • 相关阅读:
    甲午年总结
    浅谈数字营销
    机器学习笔记
    上海GDG活动有感
    我也谈谈游戏
    CSS3新增属性
    js事件详解
    DOM与BOM相关操作
    JS基础知识
    js数据类型
  • 原文地址:https://www.cnblogs.com/guxingy/p/11195098.html
Copyright © 2011-2022 走看看