Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need a solution to export asp.net page to pdf or image or word.

I have a charts and images which are there in the page. i want the entire page to be exported with same formatting as it is displayed in the page.

Any suggestion or thoughts around this would be appreciated.

Thanks in advance
Posted
Comments
[no name] 25-Jul-12 11:09am    
Google is your friend. Exporting to PDF has been asked and answered so many times it's hard to believe that you performed the most basic search and did not find anything.
murugesan.velusamy 25-Jul-12 23:39pm    
Thanks for your response. I have already done some thing which can export only the text of the page by using itextsharp. Now i need the entire page has to be exported with same formatting how as it is displayed in page. I need to achieve the same with using any open source component.

Found similar question here....

How to export aspx page(HTML content) in pdf[^]

abcpdf [^]is a good third party tool for doing this.

Hope this helps...

Sebastian
 
Share this answer
 
v2
Comments
murugesan.velusamy 25-Jul-12 23:44pm    
I am not able to go with any third party tool. suggest me to do the same using any open source component.
Madhulika Satalkar 7-Feb-13 4:14am    
even i am luking solution for same question..............my web asp contains images n text....how to convert them to pdf or an image plz suggets
You can see this render web page into pdf[^]a similar discussion on stackoverflow
 
Share this answer
 
you can use wkhtmltopdf and it is a open source components
 
Share this answer
 
v2
Comments
murugesan.velusamy 25-Jul-12 23:41pm    
thanks for your response .. can you provide some sample code for the same.
Well...

A another solution is to use the Visual Studio to generate the pdf file and create the PDF file through a report.
This report can be created easily with Crystal reports or even with the Report Designer, like this:

Dim warnings As Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim bytes As Byte()


Report.LocalReport.ReportPath = "Reportvbs1.rdlc"
Report.LocalReport.DataSources.Clear()
Report.LocalReport.DataSources.Add(New ReportDataSource("Report", SqlDataSourceRelatorio))
Report.LocalReport.DataSources.Add(New ReportDataSource("Details", SqlDataSourceRelatorioDetalhes))

bytes = Report.LocalReport.Render("Pdf", _
Nothing, mimeType, _
encoding, extension, streamids, warnings)
Dim Endereco As String = ""

After, you can generate the pdf file:

'Generate Pdf file
Dim sNomeArquivo = Rota + "_" + HoraI + "_" + HoraF + "_" + DateTime.Now.ToString("dd-MM-yyyy_KHHmmss") + Now.Millisecond.ToString()
sNomeArquivo = sNomeArquivo.Replace(":", "_")
Try
Endereco = "\\MattWeb\Files\USDG\recalls\" + sNomeArquivo.Replace(":", "_") + ".pdf"
Dim fs As New FileStream(Endereco, FileMode.Create)
fs.Write(bytes, 0, bytes.Length)
fs.Close()
Catch ex As Exception
Endereco = "C:\temp\" + sNomeArquivo + ".pdf"
Dim fs As New FileStream(Endereco, FileMode.Create)
fs.Write(bytes, 0, bytes.Length)
fs.Close()
End Try

Regards,

Leonardo Metelys
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900