New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

PDF Export

This online demo demonstrates the export to PDF feature of RadGantt.

The approach is very straight-forward - setting the EnablePdfExport property to true appends an Export button to the control toolbar. There is also a built in exportToPdf Client-side method, which can be used to trigger the export functionality from code. All of the processing is done on the client, so no postbacks are needed.

The Gantt control also exposes several properties which can be used to control the appearance of the resulting PDF page. They are located in the RadGantt.ExportSettings.Pdf section, and include:

  • Author - Sets the name of the author of the PDF document.
  • Creator - Specifies the creator of the resulting PDF document.
  • Date - The date when the PDF document is created.
  • FileName - Specifies the file name of the exported PDF document.
  • Keywords - Specifies the keywords of the exported PDF document.
  • Landscape - Boolean value indicating whether the resulting document orientation is portrait or landscape.
  • MarginBottom - Sets the bottom margin of the page.
  • MarginLeft - Sets the left margin of the page.
  • MarginRight - Sets the right margin of the page.
  • MarginTop - Sets the top margin of the page.
  • PaperSize - Specifies the paper size of the PDF document. The default "auto" means paper size is determined by content. You can also set a predefined size, such as "A4", "A3" etc.
  • ProxyURL - The URL of the server side proxy which will stream the file to the end user. A proxy will be used when the browser isn't capable of saving files locally (IE version 9 and lower and Safari). The developer is responsible for implementing the server side proxy.
  • Subject - Sets the subject of the PDF document.
  • Title - Sets the title of the PDF document.
  • DefaultVB.aspx
  • DefaultVB.aspx.vb
  • styles.css
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="DefaultVB.aspx.vb" Inherits="Telerik.Web.Examples.GanttExamples.Functionality.PdfExport.DefaultVB"  %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
     <!-- Load Pako ZLIB library to enable PDF compression -->
    <script src="../../../../Common/Scripts/pako.min.js"></script>
    <link href="styles.css" rel="stylesheet" />
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />

    <div class="demo-container no-bg">
        <telerik:RadGantt RenderMode="Lightweight" runat="server" ID="RadGantt1" Height="450px"
            EnablePdfExport="true" SelectedView="MonthView" DayView-UserSelectable="false">
        </telerik:RadGantt>
    </div>

    </form>
</body>
</html>

Support & Learning Resources

Find Assistance