help displaying PDF

0 views
Skip to first unread message

ndpace

unread,
Nov 10, 2009, 3:56:46 PM11/10/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I am a newbie and inherited this code. Please let me know if there is
needed code missing.
I need to have the FALSE side of this conditional show the PDF without
the watermark, preferably using the same procedure (SendPdfToUser).
Thanks in advance for any help, Jim


If shouldWatermark.Equals("true") Then
Dim pdfDoc As PdfDocument = New PdfDocument(filePath)
Dim newDoc As Byte() = pdfDoc.WatermarkDocument()
Dim pdfFileName As String = filePath.Substring
(filePath.LastIndexOf("\") + 1)
SendPdfToUser(pdfFileName, newDoc)
Else 'no cert
Response.Redirect("./" & path)
End If

*******************************************************************
Private Sub SendPdfToUser(ByVal filename As String, ByVal fileBytes As
Byte())
Context.Response.Clear()
Context.Response.ContentType = "application/pdf"
Context.Response.AppendHeader("content-disposition",
"attachment; filename=" + filename)
Context.Response.BinaryWrite(fileBytes)
Context.Response.Flush()
Context.Response.End()
End Sub

Jamie Fraser

unread,
Nov 11, 2009, 6:34:46 AM11/11/09
to dotnetde...@googlegroups.com
I would imagine you want something like http://dotnetdevelopment.pastebin.com/m273be5a3
Reply all
Reply to author
Forward
0 new messages