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

Free Support Forum - aspose.com

Saving pdf to MemoryStream takes more time

I am using Aspose.Pdf.Generator.Pdf to generate to dynamically generate a pdf file and then saving it to MemoryStream.

public static MemoryStream ConvertPdfToStream(Aspose.Pdf.Generator.Pdf pdf)

{

MemoryStream stream = new MemoryStream();

pdf.Save(stream);

return stream;

}

Generation of around 250 pages of pdf takes less than a minute, but saving the pdf into MemoryStream takes more than a minute.

Is there any other efficient way to save the pdf in stream.

Thanks,

Saikat

Hi Saikat,


Thanks for your inquiry. Processing time depends upon the contents and size of the files along with your system resources. Can you please share your document here? So we will test it at our end and provide you more information accordingly.

Sorry for the inconvenience faced.

Best Regards,

Hi Tilal,

I am also having a similar issue - I need to convert an html string to a pdf but it basically hangs on the step that saves it to a stream - here is my code:

public byte[] CreatePdf(string html, HttpRequestBase request)

{

Document doc = new Document();

Pdf pdf = new Aspose.Pdf.Generator.Pdf();

Text txt = new Text();

Section section = pdf.Sections.Add();

section.Paragraphs.Add(txt);

txt.IsHtmlTagSupported =

true;

MemoryStream str = new MemoryStream();

pdf.Save(str);

byte[] fileContents = str.ToArray();

return fileContents;

Thanks,

Sabeeh

Hi Sabeeh,


Thanks for your inquiry. I’m looking into your request and will update you soon.

Best Regards,

Thanks Tilal - I also sent you a file containing the entire HTML string - just wanted to confirm that you received it...

Sabeeh

Hi Sabeeh,


Thanks for your patience. I’ve received your source html string. Its a big file, even my web browser takes time to open it. I’ve tested the Html to Pdf scenario, although it takes couple of mins but ends with a empty Pdf document. I’ve logged the issue in our issue tracking system as PDFNEWNET-35167 for further investigation and resolution. We will update you about issue progress via this forum thread.

Sorry for the inconvenience faced.

Best Regards,

Hi Tilal,

Any progress on this?

Sabeeh

Hi Sabeeh,

Thanks for the inquiry, I'm afraid the reported issue is still not resolved due to some other priority tasks and It’s pending in the queue for analysis. However, I have requested the team for ETA and as soon as I get a feedback I will update you via this forum thread.

Best Regards,

Hi Sabeeh,


Thanks for your patience. Our development team has analyzed the issue and found that the HTML document is generating out of memory exception in inner HTML parser. Due to complexity of issue and other priority tasks the issue resolution is planned to 2013/Q3. We will keep you updated the issue progress via this forum thread.

Thanks again for your patience and cooperation.

Best Regards,