Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VB

Generate a PDF document from exported stream of a crystal report

0.00/5 (No votes)
10 May 2010CPOL 8.9K  
The last part can be written much easier in VB:Private Sub msGPDF_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles msGPDF.Click Dim Stream As IO.Stream = objRpt.ExportToStream(ExportFormatType.PortableDocFormat) Dim Buffer(CInt(Stream.Length)) As Byte ...
The last part can be written much easier in VB:

VB
Private Sub msGPDF_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles msGPDF.Click
    Dim Stream As IO.Stream = objRpt.ExportToStream(ExportFormatType.PortableDocFormat)
    Dim Buffer(CInt(Stream.Length)) As Byte
    Stream.Read(Buffer, 0, CInt(Stream.Length))
    My.Computer.FileSystem.WriteAllBytes("Report.pdf", Buffer, False)
    System.Diagnostics.Process.Start(fs.Name)
End Sub

License

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