You are here > Demos > Custom Interface

This demonstration shows how the developer can fully control the activePDF Portal interface, disabling buttons and hiding UI items like the bookmark and pages tabs.  Additionally, this demonstration illustrates the connection to Javascript events that can be raised in the user's browser.

<%@ Page Language="C#" CodeFile="Custom-Interface.aspx.cs" Inherits="Custom_Interface" %>

<%@ Register Assembly="APPortalUI" Namespace="APPortalUI.Web.UI" TagPrefix="apPortalUI" %>

<!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>activePDF Portal Sample</title>
    <script type="text/javascript">
        function attachPdfListeners(){
            //get id
            id = "<%= this.PdfWebControl1.DivID%>";

            //attach listeners
            (new PdfWebControlApi(id)).addEventListener("saveComplete",function(){
                window.alert("Save event raised for " + this.getKey());});
            (new PdfWebControlApi(id)).addEventListener("print",function(){
                return window.confirm("The user wants to print this PDF document. Would you like to allow it?");});
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <apPortalUI:PdfWebControl ID="PdfWebControl1" RunAt="server"
            Height="600px" 
            Width="100%" 
            OnClientLoad="attachPdfListeners();" 
            HideBookmarks="True"
            HideSideBar="False"
            HideThumbnails="True"
            />
    </div>
    </form>
</body>
</html>

using System;
using APPortal.Data.Document;
using APPortalUI.Web.UI;

partial class Custom_Interface : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            this.PdfWebControl1.CreateDocument("filename", System.IO.File.ReadAllBytes(Server.MapPath(@"pdfs\APPortalSampleForm.pdf")),
              PdfDocumentSettings.DisableAddFormFields |
              PdfDocumentSettings.DisableSelectText );
        }
    }
}

<%@ Page Language="VB" CodeFile="Custom-Interface.aspx.vb" Inherits="Custom_Interface" %>

<%@ Register Assembly="APPortalUI" Namespace="APPortalUI.Web.UI" TagPrefix="apPortalUI" %>

<!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>activePDF Portal Sample</title>
    <script type="text/javascript">
        function attachPdfListeners(){
            //get id
            id = "<%= Me.PdfWebControl1.DivID%>";

            //attach listeners
            (new PdfWebControlApi(id)).addEventListener("saveComplete",function(){
                window.alert("Save event raised for " + this.getKey());});
            (new PdfWebControlApi(id)).addEventListener("print",function(){
                return window.confirm("The user wants to print this PDF document. Would you like to allow it?");});
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <apPortalUI:PdfWebControl ID="PdfWebControl1" RunAt="server"
            Height="600px" 
            Width="100%" 
            OnClientLoad="attachPdfListeners();" 
            HideBookmarks="True"
            HideThumbnails="True"
            />
    </div>
    </form>
</body>
</html>

Option Explicit On
Option Strict On

Imports APPortal.Data.Document
Imports APPortalUI.Web.UI

Partial Class Custom_Interface
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not IsPostBack Then

            Me.PdfWebControl1.CreateDocument("filename", System.IO.File.ReadAllBytes(Server.MapPath("pdfs\APPortalSampleForm.pdf")), _
              PdfDocumentSettings.DisableAddFormFields Or _
              PdfDocumentSettings.DisableSelectText)

        End If
    End Sub
End Class