Yes, you can export a crystal report as a PDF. Use the StreamReader class convert it to bytes. Then, use Response.BinaryWrite() to write the bytes to the browser.
private
static
byte
[] GetCrystalPDF(ReportDocument rpt)
{
byte
[] buffer =
null
;
try
{
using
(var sr =
new
StreamReader(rpt.ExportToStream(ExportFormatType.PortableDocFormat)))
{
buffer =
new
byte
[sr.BaseStream.Length];
sr.BaseStream.Read(buffer, 0, buffer.Length);
rpt.Close();
rpt.Dispose();
rpt =
null
;
}
}
catch
(Exception ex)
{
// blah
}
return
buffer;
}
public static void WritePDF(HttpContext context, byte[] bytes)
{
if (context == null) return;
if (bytes == null) return;
context.Response.StatusCode = 200;
context.Response.ContentType = "application/pdf";
context.Response.AddHeader("content-length", bytes.Length.ToString());
context.Response.AddHeader("Content-Disposition", "inline");
context.Response.BinaryWrite(bytes);
}