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

[Solved] Export to Image

1 Answer 153 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Henry
Top achievements
Rank 1
Henry asked on 29 Jun 2009, 04:25 AM
Hi,
  One of the last requirement we have during evaluation for the RadControls, is the ability to create thumbnails of the created "article" to be displayed as thumbnails in the grid control. This thumbnails will serve as a preview functionality to the users while browsing through the grid control.
  After checking the RadEditor's export functionality, it has export to pdf, word, etc., but there no option to export the editor's contents as an image.
  Alternatives I can think of is, in the RadGrid, have a column with RadEditor in Preview Mode in every row, however, I'm not sure how heavy this will be - will it be fast still?.

   Is there anyway to export the Editor's content as an Image? This will truly be useful in such scenarios.
  
  Lastly, I tried the Export to PDF demo, but when setting an Image to absolute position, the exported PDF will not display as per what is shown in the editor.

Many Thanks,
Henry Wu 

1 Answer, 1 is accepted

Sort by
0
Tervel
Telerik team
answered on 02 Jul 2009, 11:24 AM
Hi Henry,

The editor does not provide such functionality, as it certainly goes beyond the scope of the control.
When you obtain your content from the server, you could try manipulating the content by feeding the editor's text content (using it's readonly Text property) to a Graphics object, e.g.

Bitmap bmImage = new Bitmap(width, height, PixelFormat.Format32bppPArgb);
Graphics grImage = Graphics.FromImage(bmImage)
grImage.DrawString(.......);

This is a limited solution, of course, because a Bitmap can be fed with text, but not with rich content such as HTML.

As an alternative, rather than using in RadGrid column with a RadEditor on each row for preview purposes, it might be better to simply use a tempated column with a

<div style="width:300px;height:300px;overflow:auto;border:1px solid red;">
Editor content gets bound here, into the DIV
</div>

Since you only need the content for preview purposes you will not need to use RadEditor.
If on the other hand, you wish to use RadEditor, you can set its Enabled=false property, which will render no scripts. To have the editor maintain its size and display scrollbar if content is larger, you will need to set
<telerik:RadEditor Width="300" Height="300" style="overflow:auto;" ..../>


Sincerely yours,
Tervel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Editor
Asked by
Henry
Top achievements
Rank 1
Answers by
Tervel
Telerik team
Share this question
or