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

How do I display a JPEG directly in the browser without exporting first?

2 Answers 92 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
briankb
Top achievements
Rank 2
briankb asked on 05 May 2009, 11:20 PM
There is an excellent example in the Help files on how to display a report as PDF directly to browser.

Is there an example on how to do the same thing as a JPEG image?

I see the examples on how to save the image to disk and I thought I knew how to render the byte array as an image. But so far I haven't been successful.

2 Answers, 1 is accepted

Sort by
0
briankb
Top achievements
Rank 2
answered on 06 May 2009, 12:45 AM
        Dim report1 As New Report1() 
        Dim mimType As String = String.Empty 
        Dim extension As String = String.Empty 
        Dim encoding As Encoding = Nothing 
        Try 
            Dim deviceInfo As New Hashtable() 
            deviceInfo("OutputFormat") = "JPEG" 
            Dim buffer As Byte() = Telerik.Reporting.Processing.ReportProcessor.Render("IMAGE", report1, deviceInfo, mimType, extension, encoding) 
            Response.Clear() 
            Response.ContentType = "image/jpeg" 
            Response.BinaryWrite(buffer) 
        Catch ex As Exception 
            Response.Write(ex) 
        End Try 
 

the above code is a slight modification of the example in the help on how to save as a jpg.
0
Steve
Telerik team
answered on 06 May 2009, 08:21 AM
Hi briankb,

This information is available in our help documentation as well - here is the relevant article: Exporting a Report Programmatically.

Sincerely yours,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
briankb
Top achievements
Rank 2
Answers by
briankb
Top achievements
Rank 2
Steve
Telerik team
Share this question
or