Outputting PDF using Response.BinaryWrite in ASP.Net

Q: I have code which modifies a PDF and saves the result to disk, I\'d
like to refactor the code so that it modifies the PDF and outputs the
result via the Asp.Net Response.BinaryWrite mechanism.

Can you tell me if there is an easy way to gain access to the PDF
memory buffer as a stream so that I can output it using
Response.BinaryWrite?

            Using PdfDocument As New PDFDoc(PdfFullPath)
                If (ApplySticker(PdfDocument) = True) Then
                    \' This is the point I\'d like to output to a
stream instead.
                    PdfDocument.Save(PdfFullPath,
SDF.SDFDoc.SaveOptions.e_linearized Or
SDF.SDFDoc.SaveOptions.e_remove_unused)
                End If
            End Using
-----
A: You can use a version of pdfdoc.Save(...) method that can save to a
memory buffer. For a concrete example please take a look at
PDFDocMemory sample project (http://www.pdftron.com/pdfnet/
samplecode.html#PDFDocMemory).

' Save the document to a memory buffer.
Dim buf(0) As Byte
Dim buf_sz As Integer = 1
doc.Save(buf, buf_sz, SDF.SDFDoc.SaveOptions.e_remove_unused)

Q: I did see that but it looked odd in that the array is only 1 byte
wide. I could not see how your code would work in that respect. Am I
missing something obvious?
----
A: The buffer size is passed-in by a reference. After calling Save()
this variable will contain the actual size of the memory buffer.