zoukankan      html  css  js  c++  java
  • Convert HTML to PDF with New Plugin

    FROM:http://www.e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/Convert-HTML-to-PDF-with-New-Plugin.html

    Converting HTML to PDF with C# PDF component is so important that we always try our best to improve our Spire.PDF better and better. We aim to make it is much more convenient for our developers to use. Now besides the previous method of converting HTML to PDF offered by Spire.PDF, we have a new plugin for html conversion to PDF. This section will focus on the new plugin of convert HTML to PDF. With this new plugin, we support to convert the HTML page with rich elements, such as HTTPS, CSS3, HTML5, JavaScript.

    You need to download Spire.PDF and install it on your system, add Spire.PDF.dll as reference in the downloaded Bin folder thought the below path '..Spire.PDFBinNET4.0Spire.PDF.dll'. And for gain the new plugin, you could get the new plugin from the download file directly: HTMLConvertor-0.2.3.3.zip

    You need to unzip the convertor plugin package and copy the folder 'plugins' under the same folder of Spire.Pdf.dll.

    C# HtmlToPdf.zip and VB.NET HtmlToPdfVB.zip, you could download and try it.

    Calling the plugins is very simple, please check the below C# code for convert HTML to PDF.

    using System.Drawing;
    using Spire.Pdf.Graphics;
    using Spire.Pdf.HtmlConverter.Qt;
    
    namespace SPIREPDF_HTMLtoPDF
    {
        class Program
        {
            static void Main(string[] args)
            {
                HtmlConverter.Convert("http://www.wikipedia.org/", "HTMLtoPDF.pdf",
                    
                    //enable javascript
                    true,
    
                    //load timeout
                    100 * 1000,
    
                    //page size
                    new SizeF(612, 792),
    
                    //page margins
                    new PdfMargins(0, 0));
                System.Diagnostics.Process.Start("HTMLtoPDF.pdf");
            }
        }
    }

    如果出现异常

    The conversion provider cann't be found.
    Please make sure:
    1. the folder "plugins" under the same folder of Spire.Pdf.dll
    2. exists "pluginsHTMLConverter.dll" and other "plugins*.dll

    首先把IIS里web对应的应用程序池,高级设置里改成32位模式

    其次要安装

    Microsoft Visual C++ 2010 Redistributable Package (x86)

  • 相关阅读:
    Jmeter使用自定义编写代码
    Jmeter关于断言
    Jmeter之函数助手
    无界面运行Jmeter压测脚本 --后知者
    接口测试全流程总结
    全面的功能测试点总结
    简述核心网
    题1:一个手机H5测试页面,页面上有一个文本输入框和一个次数的按键---测试用例编写
    2019 版_Python 常见的 170 道面试题全解析:编码规范
    2019 版_Python 常见的 170 道面试题全解析:语言特性
  • 原文地址:https://www.cnblogs.com/imust2008/p/5124044.html
Copyright © 2011-2022 走看看