Free Support Forum -

Error While Saving the PDF doc object in to MemoryStream <Its giving Compress Error>


This is what the code I writen, In my sample application the same code is working properly....but in my Actual application its not working properly..please reply ASAP

MemoryStream docStream = new MemoryStream(letterAttachment.fileContent);
//letterAttachment.fileContent: This is byte Array

MemoryStream xmlStream = new MemoryStream();

MemoryStream pdfStream = new MemoryStream();

Document doc = new Document(docStream as Stream);

doc.Save(xmlStream, SaveFormat.FormatAsposePdf);

Aspose.Pdf.Pdf pdfDoc = new Aspose.Pdf.Pdf();

pdfDoc.BindXML(xmlStream, null);

pdfDoc.Save(pdfStream); // Here its Giving COMPRESS ERROR

Please try the following codes and tell me the result.


MemoryStream memStream = new MemoryStream();

MemoryStream docStream = new MemoryStream(letterAttachment.fileContent);
doc.Save(memStream, SaveFormat.FormatAsposePdf);
memStream.Seek(0, SeekOrigin.Begin);
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
Aspose.Pdf.Pdf pdf = new Pdf();
pdf.BindXML(xmlDoc, null);

MemoryStream pdfStream = new MemoryStream();