HTML转PDF转换器 [英] HTML To PDF converter

查看:93
本文介绍了HTML转PDF转换器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以帮我转换html doc到pdf

Can ne1 pls help me to convert html doc to pdf

推荐答案

这个问题似乎每天至少出现在论坛上一次,但是没有人很想尝试为自己寻找答案。看看这个答案 [< a href =http://www.codeproject.com/Answers/203458/Please-Help-me-Convert-HTML-to-PDF.aspx#answer1target =_ blanktitle =New Window> ^ ]帮助你。
This question seems to appear on the forums at least once a day, and yet no-one bothers to try and search for the answer for themselves. Take a look at this answer[^] to help you.


执行Run函数并在'filename'中传递HTML文件。在bin文件夹中添加ghtmldoc.exe文件。您的HTML文件将在\\Upload \\ Invoice文件夹中创建。



execute Run function and pass HTML file in 'filename'. add ghtmldoc.exe file in bin folder. Your HTML file would be created at \\Upload\\Invoice folder.

public string Run(string filename)
    {
        string sFileName = filename;
        string m_Directory = Server.MapPath("~");
        System.Diagnostics.Process pProcess = new System.Diagnostics.Process();
        pProcess.StartInfo.FileName = m_Directory + "\\bin\\ghtmldoc.exe";
        pProcess.StartInfo.Arguments = "--webpage --datadir " + m_Directory + " --quiet --bodyfont Helvetica --size Letter --left 0.6in --right 0.4in --linkstyle plain --linkcolor #000ff --top 0.5in --fontsize 10 --footer t / --header ... -t pdf14 --jpeg -f " + sFileName + "_t.pdf " + sFileName + ".html";
        pProcess.StartInfo.WorkingDirectory = m_Directory + "\\Upload\\Invoice";

        pProcess.Start();
        Response.Write("Started : " + DateTime.Now.ToLongTimeString());
        pProcess.WaitForExit(20000);
        Response.Write("Done : " + DateTime.Now.ToLongTimeString());
        return "";
    }


再推荐一个类似的线程

尝试将网页转换为pdf格式 [ ^ ]
Refer one more similar thread
Trying to convert a webpage into pdf format[^]


这篇关于HTML转PDF转换器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆