<%@ Page Title="" Language="vb" MasterPageFile="~/Samples.Master" AutoEventWireup="true" CodeBehind="convert-from-js.aspx.vb" Inherits="SelectPdf.Samples.SelectPdf.Samples.convert_from_js" ValidateRequest="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>SelectPdf for .NET - Start Conversion from Javascript - VB.NET / ASP.NET</title>
    <meta name="description" content="SelectPdf Getting Start Conversion from Javascript Sample for Visual Basic / ASP.NET. Pdf Library for .NET with full sample code in C# and VB.NET." itemprop="description">
    <meta name="keywords" content="convert from javascript, pdf library, sample code, html to pdf, pdf converter" itemprop="keywords">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="mainContent" runat="server">
        <article class="post type-post status-publish format-standard hentry">
            <header class="entry-header">
                <h1 class="entry-title">SelectPdf for .NET - Start Conversion from Javascript - VB.NET / ASP.NET Sample</h1>
            </header>
            <!-- .entry-header -->

            <div class="entry-content">
                <p>
                    This sample shows how to manually start the html to pdf conversion of the SelectPdf Library for .NET using a Javascript call.
                    <br />
                    <br />
                    SelectPdf exposes a global Javascript variable called <i>selectpdf</i> in the page that is being converted. Using this variable you can check if the javascript code
                    is executed inside the converter (check if <i>typeof(selectpdf) == "object"</i>). The converter version can also be checked using <i>selectpdf.version</i>.
                    <br />
                    <br />
                    The most important feature of the Javascript interface is the possibility to manually start the page conversion to pdf with a javascript call. To do that, you must:
                    <br />
                    1. Set <i>converter.Options.StartupMode = StartupMode.Manual</i><br />
                    2. Call <i>selectpdf.start()</i> from javascript
                    <br />
                    <br />
                    Important:<br />
                    - If <i>converter.Options.StartupMode</i> is set to <i>StartupMode.Manual</i> and <i>selectpdf.start()</i> is not called from javascript, the conversion will timeout.<br />
                    - If <i>converter.Options.StartupMode</i> is set to the default value <i>StartupMode.Automatic</i>, the conversion will start without waiting for any javascript calls.
                    <br />
                    <br />
                    Below it's the link to a test page that waits for 3 seconds after it loads and then calls the javascript conversion method. 
                    Converting it in <i>StartupMode.Manual</i> mode will display the time elapsed. Converting it in <i>StartupMode.Automatic</i> mode will not show that 3 seconds time interval.
                    <br />
                    <br />
                    <asp:HyperLink ID="LnkTest" runat="server" Text="Test page" Target="_blank"></asp:HyperLink>
                </p>
                <p>
                    Url:<br />
                    <asp:TextBox ID="TxtUrl" runat="server" Width="90%" Text=""></asp:TextBox>
                </p>
                <div class="col2">
                    Conversion start mode:<br />
                    <asp:DropDownList ID="DdlStartupMode" runat="server">
                        <asp:ListItem Text="Automatic" Value="Automatic"></asp:ListItem>
                        <asp:ListItem Text="Manual" Value="Manual" Selected="True"></asp:ListItem>
                    </asp:DropDownList>
                    <br />
                </div>
                <div class="col2">
                    Timeout:<br />
                    <asp:TextBox ID="TxtTimeout" runat="server" Width="50px" Text="10"></asp:TextBox> seconds<br />
                    <br />
                </div>
                <div class="col-clear"></div>
                <p>
                    Rendering Engine:<br />
                    <asp:DropDownList ID="DdlRenderingEngine" runat="server">
                        <asp:ListItem Text="WebKit" Value="WebKit" Selected="True"></asp:ListItem>
                        <asp:ListItem Text="WebKit Restricted" Value="WebKitRestricted"></asp:ListItem>
                        <asp:ListItem Text="Chromium" Value="Chromium"></asp:ListItem>
                    </asp:DropDownList>
                </p>
                <p>
                    <asp:Button ID="BtnCreatePdf" runat="server" Text="Create PDF" OnClick="BtnCreatePdf_Click" CssClass="mybutton" />
                </p>
            </div>
            <!-- .entry-content -->
        </article>
        <!-- #post -->
</asp:Content>
