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

Controlling table widths when Exporting PDF

3 Answers 216 Views
Editor
This is a migrated thread and some comments may be shown as answers.
DTech
Top achievements
Rank 1
DTech asked on 18 Jan 2011, 08:43 PM
I need control of the table columns widths when exporting to PDF from the RadEditor.   I followed instructions from http://www.telerik.com/help/aspnet-ajax/grid-pdf-export.html (on exporting HTML to PDF).  I followed the instructions under 'Exporting HTML Tables' to test controlling table widths.  I copied and pasted the following into my RadEditor and exported the PDF and it does not work.  I suspect that it may not be working because of the automatic corrections that RadEditor makes (I disabled 2 filters but it did not correct it). 

1) How do I disable this auto correction?
2) Is the html table below correct for controlling column widths in PDFs?

Please see source:

ASPX Page:
<%@ Page Language="VB" %>
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<script runat="server">
 
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        RadEditor1.ExportToPdf()
    End Sub
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        If IsPostBack = False Then
            RadEditor1.DisableFilter(Telerik.Web.UI.EditorFilters.DefaultFilters)
            RadEditor1.DisableFilter(Telerik.Web.UI.EditorFilters.ConvertToXhtml)
        End If
    End Sub
</script>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
      <telerik:RadEditor ID="RadEditor1" Runat="server"
        ContentFilters="DefaultFilters,PdfExportFilter"><ExportSettings Pdf-PageBottomMargin="10px" Pdf-PageFooterMargin="0px" Pdf-PageHeaderMargin="0px"
            Pdf-PageLeftMargin="10px" Pdf-PageRightMargin="10px"
            Pdf-PageTopMargin="10px" OpenInNewWindow="true" >
            <Pdf PageTopMargin="10px" PageBottomMargin="10px" PageLeftMargin="10px" PageRightMargin="10px" PageHeaderMargin="0px" PageFooterMargin="0px"></Pdf></ExportSettings><Tools><telerik:EditorToolGroup></telerik:EditorToolGroup></Tools><Content>
</Content></telerik:RadEditor>
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
</div>
    </form>
</body>
</html>

Table example that I pasted directly off of help link:
<table width="300px">
   <colgroup>
       <col style="200px" />
       <col style="20px" />
   </colgroup>
   <tr>
       <td>Cell1</td>
       <td>Cell2</td>
   </tr>
</table>

After I paste the above HTML in the HTML section of the RadEditor, I clicked back to Design, then back to HTML and it changes the code to this:
<table style="width: 0px;" width="300px">
   <colgroup>
       <col style="">
       <col style="">
   </colgroup>
   <tbody><tr>
       <td>Cell1</td>
       <td>Cell2</td>
   </tr>
</tbody></table>

3 Answers, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 20 Jan 2011, 02:06 PM
Hello DTech,

The reported problem is fixed in the latest Q3 2010 SP2 release (version 2010.3.1317) of RadControls for ASP.NET AJAX. You can test the Export to PDF demo to verify that the problem is fixed.

All the best,
Rumen
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Lucas
Top achievements
Rank 1
answered on 18 Nov 2011, 04:14 PM
I am having a similar issue, and we are using the latest RadEditor with DotNetNuke. Anytime we make a table, RadEditor defined a style="width: 0px" attribute. That messes up the formatting it most browsers. This happens even if there's an existing table that we simply save.
0
Rumen
Telerik team
answered on 22 Nov 2011, 02:52 PM
Hi Lucas,

If you do not export the content to PDF, you should disable the PdfExportFilter content filter which applies  style="width:0;" to the table elements. It is a requirement that the tables has some width so that they can be exported to PDF.

Regards,
Rumen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Editor
Asked by
DTech
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Lucas
Top achievements
Rank 1
Share this question
or