Hi,
Working on a functionality to convert HTML content to PDF.
Stuck with the following point :
1. Can the radEditor control control be used with a Windows Service.
2. Can we set the Header and the footer for the resultant PDF.
3. Facing problem with exporting of the HTML table tag.
Thanks in advance. Need this urgently.
3 Answers, 1 is accepted
Straight to the points:
1) What do you mean by "using RadEditor with a Window Service"? The content area of RadEditor is a standard editable IFRAME. If you are able to implement your scenario with an editable IFRAME then you can to do it with RadEditor tool.
2) The header and footer features are not supported because the generated HTML content does not have height and it is not possible to break it in different pages.
3) In order to export a TABLE element, you should add COLGROUP and COL tags for each table row and set a table width. You can do that programmatically using the following custom content filter:
| <telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad" > |
| <ImageManager ViewPaths="~/Images" UploadPaths="~/Images" /> |
| <ExportSettings OpenInNewWindow="true" /> |
| <Content> |
| </Content> |
| </telerik:RadEditor> |
| <script type="text/javascript"> |
| var editorObject; |
| function OnClientLoad(editor, args) |
| { |
| editor.get_filtersManager().add(new MyFilter()); |
| editorObject = editor; |
| } |
| MyFilter = function() |
| { |
| MyFilter.initializeBase(this); |
| this.set_isDom(true); |
| this.set_enabled(true); |
| this.set_name("RadEditor filter"); |
| this.set_description("RadEditor filter description"); |
| } |
| MyFilter.prototype = |
| { |
| //Table neeed 1) COLGOUPS!, 2) width! |
| getHtmlContent : function(content) |
| { |
| var newContent = content; |
| var tables = newContent.getElementsByTagName("TABLE"); |
| var colCount = null; |
| var editorDocument = editorObject.get_document(); |
| for (var i=0; i < tables.length; i++) |
| { |
| var table = tables[i]; |
| table.style.width = "0px"; |
| //If there are colgroups - skip table |
| var groups = table.getElementsByTagName("colgroup"); |
| if (groups.length > 0) continue;//! |
| colCount = table.rows[0].cells.length; |
| // create colgroup |
| var newColGroup = editorDocument.createElement("colgroup"); |
| // create cols |
| var newCol; |
| for(var j=0; j<colCount; j++) |
| { |
| // create cols |
| newCol = editorDocument.createElement("col"); |
| newColGroup.appendChild(newCol); |
| } |
| //table.appendChild(newColGroup) |
| table.insertBefore(newColGroup, table.firstChild); |
| } |
| //newContent = newContent.toUpperCase(); |
| return newContent; |
| } |
| } |
| MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter); |
| </script> |
Greetings,
Rumen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Thanks for that Rumen.
Going thr' various posts, I've realised that a RadEditor control can be used in a Windows application by putting a WebBrowser control inside the Windows form.
· Is there any other way of doing it, and also is there any other Telerik control like the radEditor available for Windows applications?
· Can’t the source of an image be given be given as a url. It gives me a corrupt PDF after conversion.
The help is greatly appreciated. thanks in advance again.
Regards,
Sarita
1) the only way to use RadEditor for ASP.NET AJAX in a Windown application is demonstrates in this KB article: Using RadEditor for ASP.NET AJAX in a Windows application.
2) You can test RadMarkupEditor which is a dialog used at Design time and Run time for creation of the formatted text supported by Telerik Controls for WinForms. It is just a basic tool which could not be used for site creation. For the time being we are working on a Silverlight / WPF editor and we research the possibility to implement a WYSIWYG editor for Winforms.
3) Can you please provide an example on how to reproduce this issue along with sample content? Are you able to export the image in the content area in the Export to PDF example.Sincerely,
Rumen
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
