Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to send data to a .pdf file 1

Status
Not open for further replies.

vatawna

Programmer
Feb 24, 2004
67
US
I have a web-based form written in ASP.NET with VB on the backend for users to fill out. After the form was filled out, I'd like to have the data entered by users sent to a .pdf file for confirmation.

Does anybody know how to send data from ASP.NET/VB to a pdf file?

Thanks.
 
This is how I send a Crystal Report to a pdf format.

you can take away what you dont need

Public Sub ExportData(ByRef oRpt As Object)
Dim fs As IO.FileStream
Dim FileSize As Long
Dim oDest As New CrystalDecisions.Shared.DiskFileDestinationOptions
Dim ExportFileName As String = Server.MapPath("/") & ConfigurationSettings.AppSettings("ExportDir") & Session.SessionID & ".pdf"
Try
'Dim oExport As New CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportOptions()
oRpt.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
oRpt.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
oDest.DiskFileName = ExportFileName
oRpt.ExportOptions.DestinationOptions = oDest
oRpt.Export()
'Build Target Filename
'Send the file to the user that made the request
Response.Clear()
Response.Buffer = True
Response.AddHeader("Content-Type", "application/pdf")
' Response.AddHeader("Content-Disposition", "attachment;filename=" & Session.SessionID & ".pdf;")
fs = New IO.FileStream(ExportFileName, IO.FileMode.Open)
FileSize = fs.Length
Dim bBuffer(CInt(FileSize)) As Byte
fs.Read(bBuffer, 0, CInt(FileSize))
fs.Close()
Response.BinaryWrite(bBuffer)
Response.Flush()
Response.Close()
Catch e As Exception
End Try
End Sub




 
There are also commercial products such as:


There are quite a few others if you look about as well but the one above does offer a free product if you create a link back to their website from yours.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top