This is a migrated thread and some comments may be shown as answers.

display a PDF directly in the browser without exporting

4 Answers 204 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ken
Top achievements
Rank 1
ken asked on 06 Dec 2010, 04:36 AM
I user exactly below code, But it still show me o pop up to choose Open or Save PDF file. I use Q2_2010_v4_1_10_921












Sub
ExportToPDF(ByVal reportToExport As Telerik.Reporting.Report) Dim reportProcessor As New ReportProcessor() Dim result As RenderingResult = reportProcessor.RenderReport("PDF", reportToExport, Nothing) Dim fileName As String = result.DocumentName + ".pdf"   Response.Clear() Response.ContentType = result.MimeType Response.Cache.SetCacheability(HttpCacheability.Private) Response.Expires = -1 Response.Buffer = True Response.AddHeader("Content-Disposition", String.Format("{0};FileName=""{1}""", "attachment", fileName)) Response.BinaryWrite(result.DocumentBytes) Response.End() End Sub  '. . . ' Sample call to ExportToPDF() ExportToPDF(New Report1())

4 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 06 Dec 2010, 08:58 AM
Hello Ken,

You've probably got confused by the title of the help article, when in fact it refers to exporting without the viewer i.e. the report is not shown.
To show the PDF file directly in the browser, you should have Acrobat Reader installed on your machine and you should remove the Response.AddHeader line from the referenced code.

Kind regards,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
ken
Top achievements
Rank 1
answered on 07 Dec 2010, 10:56 PM
I remove the Response.AddHeader line and I try again.
I got this message error. (Screenshot)
I installed adobe reader v9.0

Thanks!
0
ken
Top achievements
Rank 1
answered on 07 Dec 2010, 11:03 PM
I try again. Then it 's ok.
But sometime it occur error message.
I attached 2 popup. One is choose printer popup, that 's ok.
The other one is error occur.That error perform when I click print embeded button on Report Viewer.


0
Steve
Telerik team
answered on 09 Dec 2010, 08:18 AM
Hello Ken,

We do not see an error in the second screenshot i.e. it is an empty dialog. As for the very first error you received - we were not able to reproduce it on your end and would appreciate if you provide us with steps to do so. Additionally we would appreciate if you answer the inquiries in the "Draw Line on Report" thread, so we can answer any further inquiries you might have.

Best wishes,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
Tags
General Discussions
Asked by
ken
Top achievements
Rank 1
Answers by
Steve
Telerik team
ken
Top achievements
Rank 1
Share this question
or