且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将多个aspx页面导出为一个pdf文件

更新时间:2023-02-12 22:11:40

The easiest way to acheive this is by using the WebRequest class. You would download all of the content and place it into some sort of container (I typically use the StringBuilder class but could be another stream). Then you would write the content of the container to your PDF document. You will most like need to strip out the extra HTML tags and play with the formatting.

HashSet<string> urls = new HashSet<string>() { "http://www.microsoft.com", "http://www.google.com", "http://www.codeproject.com" };
StringBuilder contentToWrite = new StringBuilder();

foreach (var url in urls)
{
    WebRequest request = WebRequest.Create(url);
    WebResponse response = request.GetResponse();

    using (StreamReader streamReader = new StreamReader(response.GetResponseStream()))
    {
        contentToWrite.Append(streamReader.ReadToEnd());
    }
}
</string></string>


i am having print button on third page. On clicking it, pdf of all three pages has to be generated. How to do it


Follow These Links...Hope.. these will be useful for you
I am providing you these links...Try these out. don't accept anyone give you specific answer. shoot your problem yourself...it's the best practice..
On button click place url of pages what pages you want to export..Try below methods and use what you find more useful and pro efficient..

Pdfizer, a dumb HTML to PDF converter, in C#[^]


Convert ASP.NET web page to PDF[^]


Pdfizer, a dumb HTML to PDF converter, in C#[^]

Generate PDF documents from a HTML page using ASP.NET[^]


Convert ASP.NET web page to PDF[^]

Show HTML In PDF[^]

How to create PDF file from a HTML page asp.net C#[^]

https://hspinfo.wordpress.com/2008/01/12/how-to-convert-html-content-to-pdf-file/[^]

http://***.com/questions/564650/convert-html-to-pdf-in-net[^]

http://www.developerfusion.com/code/4266/how-to-create-pdf-files-from-aspnet-pages/[^]

http://aspdotnetcodebook.blogspot.in/2008/07/how-to-export-content-of-gridview-to.html[^]


http://www.nullskull.com/q/10125344/how-to-convert-web-page-into-pdf.aspx[^]

http://pdfcrowd.com/web-html-to-pdf-net/[^]
http://***.com/questions/6013538/generating-pdf-from-webpage-in-asp-net[^]


http://***.com/questions/8504415/how-to-convert-aspx-to-pdf-using-c[^]

Convert webpage to pdf[^]

Thanks...