After a PdfFileStamp- how to send output to browser?

Hi

After using PdfFileStamp with MemoryStreams, how would you recommend sending the output to a browser.

I have tried using the following code:-

MemoryStream outStream = new MemoryStream( (int)_pdfStream.Length );
PdfFileStamp stamper = new PdfFileStamp( _pdfStream, outStream );
Stamp backgroundStamp = new Stamp();
...
stamper.AddStamp( backgroundStamp );
stamper.Close();

Pdf pdfOut = new Pdf();
pdfOut.BindXML( outStream, null );
pdfOut.Save( pdfFilename, Aspose.Pdf.SaveType.OpenInAcrobat, Response );

but I got this System.Xml.XmlException:

Data at the root level is invalid. Line 1, position 1.

Any suggests please.

Regards,
Ian.

Hi Ian,

I think this issue is caused by Aspose.Pdf Schema.

The method BindXML needs to input the object which contains the content compatible with the Schema defined by Aspose.Pdf.

As a workable solution, please try following codes.

[Code]

//response to user's web explorer.
Response.Expires = 0;
Response.Buffer = true;
Response.ClearContent();
Response.AddHeader("content-disposition", "inline; filename=" + pdfFilename);
Response.ContentType = "application/pdf";
Response.BinaryWrite(outBuf);
outStream.Close();
Response.End();