Essential Studio for Asp.Net | Demos

SHOWCASE SAMPLES
Showcase samples
    This sample demonstrates the creation of simple PDF document. It draws the string “Hello world!” in the desired location using the PDF standard font.


    It is also possible to draw different language of text with different fonts using TrueType fonts and CJK fonts.
    <%@ Page Title="PDF-Hello World-ASP.NET-SYNCFUSION"   Language="C#" MetaDescription="Example [C#] to create simple hello world PDF document in ASP.NET Web Forms using Syncfusion .NET PDF library." MasterPageFile="~/Samplebrowser.Master" AutoEventWireup="true" CodeBehind="HelloWorld.aspx.cs" Inherits="WebSampleBrowser.Pdf.HelloWorld" %>
    
    <asp:Content ID="Content2" ContentPlaceHolderID="ControlsSection" runat="server">
         <div style = "font-size: 17px;font-weight: 400;">
                       This sample demonstrates the creation of simple PDF document. It draws the string “Hello world!” in the desired location using the <a href="https://help.syncfusion.com/file-formats/pdf/working-with-text#draw-text-using-standard-fonts">PDF standard font.</a> 
    
        </div>
        <br/>
       
                   
                    <div style="border: solid 1px #788DB3; padding: 5px 7px 5px 7px; background-color: #EDF0F7;">
                        <table width="100%">
                            <tr>
                                <td align="left" width="100%" cellpadding="0" cellspacing="0" border="0">
                                    <asp:CheckBox ID="CheckBox1" runat="server" Text=" Open Document inside Browser" 
                                         />
                                </td>
                                <td align="right">
                                    <asp:Button Width="100px" Style="margin-right: 3px" ID="Button1" Height="27px" runat="server"
                                         OnClick="Button1_Click" Text="Create PDF" />
                                </td>
                            </tr>
                        </table>
                    </div>
               <br/>
               <div style = "font-size: 17px;font-weight: 400;">
            
                    
            It is also possible to draw different language of text with different fonts using <a href="https://help.syncfusion.com/file-formats/pdf/working-with-text#draw-text-using-truetype-fonts">TrueType fonts</a> and <a href="https://help.syncfusion.com/file-formats/pdf/working-with-text#draw-text-using-cjk-fonts">CJK fonts.</a>
               </div>
               
               
    </asp:Content>
    
    
    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Drawing;
    using Syncfusion.Pdf;
    using Syncfusion.Pdf.Graphics;
    using Syncfusion.Pdf.Interactive;
    
    
    namespace WebSampleBrowser.Pdf
    {
        public partial class HelloWorld : System.Web.UI.Page
        {
            # region Page Load
            /// <summary>
            /// Handles page load
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            protected void Page_Load(object sender, EventArgs e)
            {
    
            }
            # endregion
            # region Fields
            PdfDocument doc;
            #endregion
            # region Events
            /// <summary>
            /// Creates PDF
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            protected void Button1_Click(object sender, EventArgs e)
            {
                doc = new PdfDocument();
                //Add a page
                PdfPage page = doc.Pages.Add();
    
                //Create Pdf graphics for the page
                PdfGraphics g = page.Graphics;
    
                //Create a solid brush
                PdfBrush brush = new PdfSolidBrush(System.Drawing.Color.Black);
    
                //Set the font
                PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 36);
    
                //Draw the text
                g.DrawString("Hello world!", font, brush, new PointF(20, 20));
    
                //Stream the output to the browser.    
                if (this.CheckBox1.Checked)
                {
                    doc.Save("Sample.pdf", Response, HttpReadType.Open);
                }
                else
                {
                    doc.Save("Sample.pdf", Response, HttpReadType.Save);
                }
            }
            # endregion
        }
    }