如何将aspx页面保存为pdf格式 [英] How to save the aspx page to pdf format

查看:179
本文介绍了如何将aspx页面保存为pdf格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

我在aspx页面内有一个标签值数量的面板......我需要以pdf格式保存面板数据.....

Hi friends,
I have one panel with number of label values inside the aspx page...I need to save the panel datas in pdf format.....

推荐答案

看看:

http://aspdotnetcodebook.blogspot.in/2009/04/how-to-convert-web-page-to-pdf.html [ ^ ]

http://stackoverflow.com/questions/1220423/directly-convert- aspx-to-pdf [ ^ ]

http:/ /stackoverflow.com/questions/5814226/how-to-convert-aspx-pa ge-in-to-pdf [ ^ ]

希望这可以帮到你。
have a look at :
http://aspdotnetcodebook.blogspot.in/2009/04/how-to-convert-web-page-to-pdf.html[^]
http://stackoverflow.com/questions/1220423/directly-convert-aspx-to-pdf[^]
http://stackoverflow.com/questions/5814226/how-to-convert-aspx-page-in-to-pdf[^]
hope this helps you.


abcpdf是我用过的一个方便的工具.... 。
abcpdf is a handy tool which I have used.....


你可以这样看:



[ ^ ]



或者你可以搜索谷歌上的
You can look this:

[^]

or you can search the
wnvhtmltopdf.dll, v4.0.30319

并下载它

使用此代码

on google and download it
use this code

/// <summary>
/// htm lto byte array
/// </summary>
/// <param name="url">file path</param>
/// <returns>byte array</returns>
public byte[] HtmlToPdfBytes(string htmlContent)
{
    if (string.IsNullOrWhiteSpace(htmlContent))
    {
        return null;
    }
    try
    {
        HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter();
        htmlToPdfConverter.LicenseKey = "NLqpu6quu6u7qqq1q7uoqrWqqbWioqKi";
        htmlToPdfConverter.PdfDocumentOptions.PdfPageSize = PdfPageSize.A4;
        htmlToPdfConverter.PdfDocumentOptions.BottomMargin = 30;
        htmlToPdfConverter.PdfDocumentOptions.TopMargin = 30;
        htmlToPdfConverter.PdfDocumentOptions.LeftMargin = 30;
        htmlToPdfConverter.PdfDocumentOptions.RightMargin = 30;
        htmlToPdfConverter.DownloadAllResources = true;
        htmlToPdfConverter.NavigationTimeout = 6000;
        //htmlToPdfConverter.ImagePartSize = 4000;
        return htmlToPdfConverter.ConvertHtml(htmlContent, "");
    }
    catch (Exception ex)
    {
        logger.Error("html to byte  array  function have some error ,the error message is :", ex.Message);
        return null;
    }
}





希望这可以帮到你。



hope this helps you.


这篇关于如何将aspx页面保存为pdf格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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