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

[Solved] Problems with ExportToPDF function

1 Answer 125 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Aytaç Utku TOPAL
Top achievements
Rank 2
Aytaç Utku TOPAL asked on 08 Jul 2009, 05:00 PM
Hi,
I am using RadEditor which is Used by largely Turkish End-Users to provide them to create PDFs. Therefore, HTML window is not shown. But I have problems with Tables and Turkish Character when I export the content to PDF files. I guess third party HTML2PDF tool that radeditor using, does not support Turkish and not good at Converting Tables.  Do you have any idea about how can I walk around these?
Many Thanks in Advance
Kind Regards.
Aytaç Utku TOPAL

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 Jul 2009, 12:02 PM
Hi Aytaç,

Currently to export a TABLE element, you should add COLGROUP and COL tags for each table row and set 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>  


You can find information how to export Uicode characters in this forum thread: ExportToPdf Roadmap.

Kind regards,
Rumen
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
Aytaç Utku TOPAL
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Share this question
or