Gnostice PDFOne .NET PDF Viewer is the next-generation PDF viewing technology for ASP.NET WebForms developers. The PDFViewer control supports viewing and printing PDF documents. It works in both desktop and mobile browsers.




Client Side APIs
Properties  : 
 
Methods  :               
Events  :  OnPageChanged     Page Number:    
  • Zero footprint ASP.NET Control
  • No browser plug-in
  • Compatible with all browsers
  • Single click PDF printing on client printer
  • Save copy of PDF on client computer (Note: Can be disabled)
  • Multipage continuously scrollable viewer
  • Painless implementation, customization and deployment
  • Fully customizable through control properties and client side object
  • Perform all operations through client side JavaScript when required

How to display PDF documents in ASP.NET WebForms applications?


Step 1:   Add the following references to your project:
  • BouncyCastle.Crypto.dll
  • Gnostice.PDFOne.dll
  • Gnostice.PDFOne.Controls.Web.dll
  • Gnostice.XtremeFontEngine.dll
  • Gnostice.XtremeImageEngine.dll
  • Ionic.Zlib.dll

Step 2:   Drag and drop the ScriptManager on the Form to get AJAX functionality for the viewer. Update web.config file with the following settings:

  <system.web>
      <httpHandlers> 
          <add verb="GET,POST" path="PDFViewer.axd"  
            type="Gnostice.PDFOne.Controls.Web.PDFViewer, Gnostice.PDFOne.Controls.Web"/> 
      </httpHandlers>
  </system.web>

                        
<system.webServer> 
    <handlers> 
          <add name="SPImage" verb="GET,POST" path="PDFViewer.axd"  
            type="Gnostice.PDFOne.Controls.Web.PDFViewer, Gnostice.PDFOne.Controls.Web"/>
      </handlers>
  </system.webServer>

Step 3:   Integrating Viewer Control:

Option 1:   Add Viewer Control Programmatically:

  PDFViewer PDFViewer1 = new PDFViewer();
  PDFViewer1.LoadDocument("sample.docx");	
  Panel1.Controls.Add(PDFViewer1);	  

Option 2:   Drag-Drop Viewer Control in design mode

Drag and drop the PDFViewer control on your form.

Default.aspx after performing this step:

<%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Gnostice.PDFOne.Controls.Web" Namespace="Gnostice.PDFOne.Controls.Web" TagPrefix="GnosticeViewer" %>
                                    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Gnostice PDF Viewer Sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
         <asp:Panel ID="Panel1" runat="server">
           /* 'PDFViewer1' is the default name of the client object that is automatically instantiated and available in the page's script section. 
                Use the client object to perform operations on the PDF Viewer by calling its methods and accesing its properties  */ 
            <GnosticeViewer:PDFViewer ID="PDFViewer1" runat="server" Height="600px" Width="800px" ClientObjectName="PDFViewer1">
            </GnosticeViewer:PDFViewer>
        </asp:Panel>
    </div>
    </form>
</body>
</html>

In the Load event of the Default Page, call LoadDocument on PDFViewer control passing the document to load.

Default.aspx.cs after performing this step:

using System;
partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       PDFViewer1.LoadDocument("Sample.docx");
    }
}
Option 1:   Add Viewer Control Programmatically:

Dim PDFViewer1 As New Gnostice.PDFOne.Controls.Web.PDFViewer()

//Load PDF Document in the Viewer
PDFViewer1.LoadDocument("Sample.docx")

//Add control to Panel
Panel1.Controls.Add(PDFViewer1)

Option 2:   Drag-Drop Viewer Control in design mode

Drag and drop the PDF Viewer control on your form.

Default.aspx after performing this step:

<%@ Page Language="VB" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="Gnostice.PDFOne.Controls.Web Namespace="Gnostice.PDFOne.Controls.Web" TagPrefix="GnosticeViewer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Gnostice PDF Viewer Sample</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
         <asp:Panel ID="Panel1" runat="server">
           // 'PDFViewer1' is the default name of the client object that is automatically instantiated and available in the page's script section. 
           //     Use the client object to perform operations on the PDF Viewer by calling its methods and accesing its properties  */ 
            <GnosticeViewer:PDFViewer ID="PDFViewer1" runat="server" Height="600px" Width="800px" ClientObjectName="PDFViewer1">
            </GnosticeViewer:PDFViewer>
        </asp:Panel>
    </div>
    </form>
</body>
</html>

In the Load event of the Default Page, call LoadDocument on PDFViewer control passing the document to load.

Default.aspx.vb after performing this step:

Public Class _Default Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        PDFViewer1.LoadDocument("Sample.docx")
    End Sub
End Class

© 2002-2017 Gnostice Information Technologies Private Limited. All rights reserved.