This is a migrated thread and some comments may be shown as answers.

Help - Exporting RadRichTextBox document to a MemoryStream causes an OutOfMemoryException

1 Answer 100 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Phuc
Top achievements
Rank 1
Phuc asked on 29 Mar 2017, 10:06 AM

Hi there,

I'm having a Word document (6MB) which has 11 pages with image.

I'm using RadRichTextBox to load it into and then export it to a MemoryStream, then I got an OutOfMemoryException.

Here is the code sample:

                IDocumentFormatProvider pdf = DocumentFormatProvidersManager.GetProviderByExtension(ext);
                pdf.Export(radRichTextBox1.Document, stream);

When debugging, I observed that the stream is quite big (33MB). Could you please let me know why the stream is really big like that.

How can I fix the issue?

 

1 Answer, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 03 Apr 2017, 08:46 AM
Hello Phuc,

I am sorry to hear you have encountered such an issue.

As a possible solution, I can recommend you to check our help article regarding the export setting of our PdfFormatProvider. PdfFormatProvider, there is a property named "ImagesCompressionMode" which you can use to control how the images will be compressed on export.

I have to mention that we are aware of one bug related to exporting images as watermarks or in header/footer. Here is the link to the public item in our feedback portal: OutOfMemoryException when exporting document containing image as or in header/footer to PDF.

You have opened two threads for this problem in WPF and Silverlight forums. This brings a bit of confusion to which is the exact technology you are using.
In the other thread you have mentioned that you are using a version from 2015, please have in mind that a lot of problems have been fixed since then and I can recommend you to check if the described problem is still reproducible in our latest version.

If nothing from the above information is helpful I will recommend you to open a new support ticket and provide a sample document which we can use to reproduce the problem.

Regards,
Mihail
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
RichTextBox
Asked by
Phuc
Top achievements
Rank 1
Answers by
Mihail
Telerik team
Share this question
or