We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Open PDF from Memory Stream

Using C#, .Net 2.0, I have a PDF in a Byte Array that I successfully put into a MemoryStream. However, when I create a Pdf object using that MemoryStream, the Pdf object is empty. How can I open an existing PDF that I have stored in a MemoryStream or Byte Array so that I can modify it and return it via the MemoryStream?<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Pseudo code:

private MemoryStream AlterPdf(MemortyStream ms)


// ms.Length > 1000 and is a valid PDF

Pdf pdfDoc = new Pdf(ms);

// pdfDoc.PageCount returns 0 here??

//set properties on pdfDoc


return ms;



Thanks for your interest in our products.

Pdf class present under Aspose.Pdf.Generator namespace provides the feature to create PDF document from scratch and in order to load an existing PDF file, please try using Document class present under Aspose.Pdf namespace.

Document doc = new Document(ms);