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

Export to PDF

- OR -

Loaded File:

This example demonstrates export of documents to PDF using RadWordsProcessing. You can upload Word(docx), RTF, HTML or plain text document and convert it to PDF.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • scripts.js
  • styles.css
<%@ Page Title="" Language="C#"  AutoEventWireup="true" CodeFile="DefaultCS.aspx.cs" Inherits="WordsProcessing_ExportToPDF_DefaultCS" %>

<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
    <script src="scripts.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
        
        <div id="exportToPdf" class="demo-container size-custom">
            <telerik:RadAsyncUpload RenderMode="Lightweight" runat="server" ID="RadAsyncUpload1" HideFileInput="true" OnClientFileUploaded="demo.OnClientFileUploaded" OnClientValidationFailed="demo.OnClientValidationFailed"
                OnFileUploaded="RadAsyncUpload1_FileUploaded" AllowedFileExtensions=".docx,.rtf,.txt,.html" />
            <div class="fileImages">
                <span class="column">
                    <telerik:RadButton RenderMode="Lightweight" ID="Button1" Text="Load Custom Document" AutoPostBack="false" OnClientClicked="demo.UploadFile" runat="server"
                        ToolTip="Please load a file with one of the following extensions: .docx, .rtf, .html or .txt" />
                    <span class="imageContainer">
                        <asp:Image ImageUrl="./Images/CustomDocumentImage.png" ID="CustomDocumentImage" runat="server" />
                    </span>
                </span>
                <asp:Label Text="- OR -" ID="OrLabel" runat="server" />
                <span class="column">
                    <telerik:RadButton RenderMode="Lightweight" Text="Load Template Document" ID="LoadSampleDocumentButton" AutoPostBack="false" OnClientClicked="demo.UploadSampleDocument" runat="server" />
                    <span class="imageContainer">
                        <asp:Image ImageUrl="./Images/JohnGrishamThumbnail.png" ID="SampleDocumentImage" runat="server" />
                    </span>
                </span>
            </div>
            <hr />

            <span>Loaded File: </span>
            <asp:Label Text="" ID="FileLabel" runat="server" />
            <hr style="clear: both;" />
            <telerik:RadButton RenderMode="Lightweight" Text="Export to PDF" ID="DownloadButton" OnClientClicking="demo.CheckDownload" OnClick="SaveButton_Click" runat="server" CssClass="downloadBtn rbPrimaryButton" />
        </div>

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

Support & Learning Resources

Find Assistance