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)

  • 相关阅读:
    JavaScript高级-----8.函数进阶(2)
    JavaScript高级-----7.函数进阶(1)
    2014-10-18 来美半个月
    修手机记
    圆梦美利坚之三:租房记
    圆梦美利坚之二:买机票记
    Hadoop 停止Job
    IIS应用程序池数目
    HTML5 microdata
    Java sql helper[转]
  • 原文地址:https://www.cnblogs.com/imust2008/p/5124044.html
Copyright © 2011-2022 走看看