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

Reply via email to