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

HTML TO PDF Example does not work

3 Answers 237 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Atlas
Top achievements
Rank 1
Atlas asked on 13 Jul 2009, 10:51 PM
I am looking into your editor HTML to PDF conversion demo: http://demos.telerik.com/aspnet-ajax/editor/examples/pdfexport/defaultcs.aspx and converting the editor to PDF only converts the visible content. If you scroll further down the editor content, you placed a table with browser info and graphics in it, but this data does not render to the pdf, Why?
Is this the only example you have on your site?
Is the pdf conversion tool unable to convert form elements (checkboxes, textboxes) into pdf?
What HTML elements can the generator convert to pdf?

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 14 Jul 2009, 10:03 AM
Hi Nano,

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 additional information on how to use the ExportToPdf feature of RadEditor in this forum thread ExportToPdf Roadmap. The third party converter that RadEditor uses to export the HTML to PDF content does not support input elements.

Sincerely yours,
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.
0
Markus
Top achievements
Rank 1
answered on 06 Aug 2018, 01:32 PM

Hi Rumen

Is your statement: "The third party converter that RadEditor uses to export the HTML to PDF content does not support input elements." still valid?

I couldn't find this restriction in the "Unsupported Features and Scenarios" section of the "RadEditor - Export to PDF" documentation. So it should work now? (If it should work, then I'm doing something wrong, because the controls don't show up in the PDF document.)

Thanks for your answer.

Regards
Markus

0
Rumen
Telerik team
answered on 06 Aug 2018, 03:19 PM
Hi Markus,

I confirm that the built-in PDF exporter library used by RadEditor does not support input and textareas.

What you can try is to use another third party library as the RadPDFProcessing to export the textboxes. You can find an example of integration with it at Extending the RadEditor PDF exporting with PdfFormatProvider. The demo exports only the textboxes contents without the UI of the HTML elements.

Regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Editor
Asked by
Atlas
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Markus
Top achievements
Rank 1
Share this question
or