Forum Moderators: open
'-- On PDF.vb
'-- I need to pass back the value of filename to results.aspx.vb
'-- How would I go about doing that?
'-- I thought I could add filename to the Return but it didn't work.
'-- Don't know much about memStream
Public Shared Function getPDF(ByVal oDict As Dictionary) As System.IO.MemoryStream
Dim rpt
Dim sb As New StringBuilder
Dim pdfPath As String = System.AppDomain.CurrentDomain.BaseDirectory() & "tempPDFs"
If Not System.IO.Directory.Exists(pdfPath) Then
System.IO.Directory.CreateDirectory(pdfPath)
End If
Dim output_type As String = oDict("file")
rpt = New rptBound
Dim localFS As String = System.IO.Path.GetDirectoryName(pdfPath)
Dim uniEncoding As New UnicodeEncoding
Dim memStream As New MemoryStream(1000)
Dim _xPDF As New Export.Pdf.PdfExport
Dim filename As String = pdf.GetRandomFileName(localFS + "\tempPDFs", "rptBound" & "_", "pdf")
_xPDF.Export(rpt.Document, filename)
Dim fs As Byte() = uniEncoding.GetBytes(filename)
memStream.Write(fs, 0, fs.Length)
'-- Need to return the value of filename
Return memStream
End Function