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
Using PdfDocument As New PDFDoc(PdfFullPath)
If (ApplySticker(PdfDocument) = True) Then
\' This is the point I\'d like to output to a
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/
' 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)