I use AvtiveReports .Net to generate a PDF document which I can preview in the browser. No problem!
Problem, I want to send the document DIRECTLY to the printer without having to preview it. How do I do it?
Response.ContentType = "application/pdf"
' IE & Acrobat seam to require "content-disposition" header being in the response. If you don't add it, the doc still works most of the time, but not always.
' this makes a new window appear: Response.AddHeader("content-disposition","attachment; filename=MyPDF.PDF")
Response.AddHeader("content-disposition", "inline; filename=MyPDF.PDF")
' Create the PDF export object
Dim pdf As PdfExport = New PdfExport()
' Create a new memory stream that will hold the pdf output
Dim memStream As System.IO.MemoryStream = New System.IO.MemoryStream()
' Export the report to PDF:
pdf.Export(rpt.Document, memStream)
' Write the PDF stream out
Response.BinaryWrite(memStream.ToArray())
' Send all buffered content to the client
Response.End()
Problem, I want to send the document DIRECTLY to the printer without having to preview it. How do I do it?
Response.ContentType = "application/pdf"
' IE & Acrobat seam to require "content-disposition" header being in the response. If you don't add it, the doc still works most of the time, but not always.
' this makes a new window appear: Response.AddHeader("content-disposition","attachment; filename=MyPDF.PDF")
Response.AddHeader("content-disposition", "inline; filename=MyPDF.PDF")
' Create the PDF export object
Dim pdf As PdfExport = New PdfExport()
' Create a new memory stream that will hold the pdf output
Dim memStream As System.IO.MemoryStream = New System.IO.MemoryStream()
' Export the report to PDF:
pdf.Export(rpt.Document, memStream)
' Write the PDF stream out
Response.BinaryWrite(memStream.ToArray())
' Send all buffered content to the client
Response.End()