Convert RichEditBox Content to SoftwareBitmap

Hi Team, I want to convert RichEditBox content to SoftwareBitmap in background thread .How can I achieve this?


5 Replies

SS Suganya Sethuraman Syncfusion Team October 19, 2021 11:26 AM UTC

Hi Sameer,

Greetings from Syncfusion.

We are currently validating on this, and we will update the complete details on October 21, 2021. We appreciate your patience until then.

Regards,
Suganya Sethuraman.
 



KG Kalaivannan Ganesan Syncfusion Team October 21, 2021 06:48 AM UTC

Hi Sameer,

Thanks for the patience.

The UWP SfRichTextBoxAdv control has API called GetPageAsImageAsync() which returns the specified page of SfRichTextBoxAdv as BitmapImage instance asynchronously.

API reference:
https://help.syncfusion.com/cr/uwp/Syncfusion.UI.Xaml.RichTextBoxAdv.SfRichTextBoxAdv.html#Syncfusion_UI_Xaml_RichTextBoxAdv_SfRichTextBoxAdv_GetPageAsImageAsync_System_Int32_

Also, we have created a sample to demonstrate how to retrieve the pages in SfRichTextBoxAdv as bitmap images which can be downloaded from the below location.

Sample:
https://www.syncfusion.com/downloads/support/forum/169711/ze/SfRichTextBoxAdv_Image-1082122369

Please let us know if you have any other questions

Regards,
Kalaivannan Ganesan
 



SA Sameer October 21, 2021 09:33 AM UTC

Hi  Kalaivannan Ganesan,


Thanks for the reply. But my use case is different. 

1) Create Textbox, entered text and tap on save button. 

2) On tap of save, I am storing textbox text to to DB/textFile(.txt).

3) On App relaunch,  retrieve the text from DB/.txt file 

4)  Convert the text to image in background thread. Please note, at this level I don't have access to RichEditBox Element.


Let me know if you have any queries regarding the use case. Thanks!



KG Kalaivannan Ganesan Syncfusion Team October 22, 2021 05:58 PM UTC

Hi Sameer,

Thanks for the update.

We are working towards creating a sample to achieve your requirement. We will update you with further details on 25th October 2021.

Please let us know if you have any other questions.

Regards,
Kalaivannan Ganesan 



KG Kalaivannan Ganesan Syncfusion Team October 25, 2021 08:44 PM UTC

Hi Sameer,

Thanks for the patience,

We have created a sample to save the SfRichTextBoxAdv content as a text file in the local folder. And retrieve the text from the local file and load it again in SfRichTextBoxAdv.

But regarding converting the content as an image in the background thread is not possible in the UWP platform. To convert the content as an image our control should be added in view. Because we are using rendertargetbitmap to render our canvas as an image. Which is renders a snapshot of a UIElement visual tree to an image source.

Note
If you store the SfRichTextBox content as a text file, it will store only the plain text, and formatting (bold, italic, font family, and font size and color) is not stored. So, if you require to store content with formatting then you should store it as an RTF file.

Sample:
https://www.syncfusion.com/downloads/support/forum/169711/ze/SfRichTextBoxAdv_Images1615127598

Please let us know if you have any other questions.

Regards,
Kalaivannan Ganesan 


Loader.
Up arrow icon