Neevia Technology Sites:   www.neevia.com  |  docuPub.com  |  www.neeviaPDF.com
:: Home :: Products :: Technical Support :: About Us :: Contact Us
Technical support > Neevia Document Converter Pro code samples
Example 3: How to convert an URL from ASP.NET  Print Example 
  • Copy the Document Converter Pro .NET assembly from the c:\program files\neevia.com\docConverterPro\.Net\ folder into your web site bin folder;
  • Copy the following ASPX scripts (main.aspx, checkstatus.aspx, error.aspx and done.aspx) into your web site root.
Note: Scroll down for the C# samples.

Visual Basic
Main.aspx
<%@ Page Language="VB" %>
<HTML>
<HEAD>
   <SCRIPT runat="server">
      Sub Button1_OnClick(Source As Object, e As EventArgs)
        if Trim(Request("myUrl"))<>"" Then
          Dim DC = New Neevia.docConverter
          Dim docID = DC.GUID & ".url"

          DC.setParameter("DocumentOutputFormat", "PDF")
          DC.setParameter("DocumentOutputFolder", Server.MapPath("."))
          DC.setParameter("PDFAutoRotatePage", "All")

          Dim rVal : rVal=DC.submitUrl(Trim(myUrl.Value),docID,"")
          If rVal<>0 Then Response.Redirect("error.aspx")
          Response.Redirect("checkStatus.aspx?docID="& docID)
        End If
      End Sub
   </SCRIPT>
</HEAD>
<BODY><CENTER>
<FORM id="Form1" method="post" runat="server">
Url to convert:
<INPUT id="myUrl" type="text" name="myUrl" runat="server"><BR>
<INPUT id="Submit1" type="submit" value="Convert URL" 
OnServerClick="Button1_OnClick" name="Submit1" runat="server">
</FORM>
</BODY>
</HTML>
checkStatus.aspx
<%@ Page Language="VB" %>
<HTML>
<HEAD>
   <SCRIPT runat="server">
     Sub Page_Load(Source As Object, e As EventArgs)
       Dim DC = New Neevia.docConverter

       DC.setParameter("DocumentOutputFormat", "PDF")
       DC.setParameter("DocumentOutputFolder", Server.MapPath("."))

       Dim docID : docID=Request("docID")
       Dim rVal : rVal=DC.checkStatus(docID,"")
       If rVal=0 Then 
         Response.Redirect("done.aspx?docID="& _
                            System.IO.Path.ChangeExtension(docID,".pdf"))
       End If    
      If rVal<>2 Then Response.Redirect("error.aspx")
    End Sub
   </SCRIPT>
 <TITLE>Neevia.com</TITLE>
 <META HTTP-EQUIV="refresh" CONTENT="2">
</HEAD>
<BODY><BR><BR><CENTER>
<H1>CONVERTING - PLEASE WAIT!!!</H1>
</BODY>
</HTML>
error.aspx
<HTML>
<BODY><BR><BR><CENTER>
<H1>THERE WAS AN ERROR CONVERTING THE DOCUMENT</H1>
</BODY>
</HTML>
done.aspx
<HTML>
<BODY topMargin="0" leftMargin="0" scroll="no">
<EMBED src="<%= Request("docID") %>" width="100%" height="100%" fullscreen="yes">
</BODY>
</HTML>
VC#
Main.aspx
<%@ Page Language="C#" %>
<%@ Assembly Name = "docConverter" %>
<%@ Import Namespace = "Neevia" %>
<HTML>
<HEAD>
   <SCRIPT runat="server">
      void Button1_OnClick(object Source, EventArgs e)
      {
        if (myUrl.Value != "") {
           Neevia.docConverter DC = new Neevia.docConverter();
           string docID = DC.GUID() + ".url";

           DC.setParameter("DocumentOutputFormat", "PDF");
           DC.setParameter("DocumentOutputFolder", Server.MapPath("."));
           DC.setParameter("PDFAutoRotatePage", "All");

           int rVal;
           rVal = DC.submitURL(myUrl.Value,docID,"");
           if (rVal!=0) Response.Redirect("error.aspx?"+rVal);
           Response.Redirect("checkStatus.aspx?docid="+ docID);
        }
      }
   </SCRIPT>
</HEAD>
<BODY><CENTER>
<FORM id="Form1" method="post" runat="server">
Url to convert: <INPUT id="myUrl" type="text" name="myUrl" runat="server"><BR>
<INPUT id="Submit1" type="submit" value="Convert Url" 
OnServerClick="Button1_OnClick" name="Submit1" runat="server">
</FORM>
</BODY>
</HTML>
checkStatus.aspx
<%@ Page Language="C#" %>
<%@ Assembly Name = "docConverter" %>
<%@ Import Namespace = "Neevia" %>
<HTML>
<HEAD>
   <SCRIPT runat="server">
     void Page_Load(object Source, EventArgs e)
     {
       Neevia.docConverter DC = new Neevia.docConverter();

       DC.setParameter("DocumentOutputFormat", "PDF");
       DC.setParameter("DocumentOutputFolder", Server.MapPath("."));

       string docID = Request.QueryString.Get("docid");
       int rVal = DC.checkStatus(docID,"");
       if (rVal==0){
         Response.Redirect("done.aspx?docID=" +
                           System.IO.Path.ChangeExtension(docID,".pdf"));
       }
       if (rVal !=2 ) Response.Redirect("error.aspx?"+docID);
    }
   </SCRIPT>
 <TITLE>Neevia.com</TITLE>
 <META HTTP-EQUIV="refresh" CONTENT="2">
</HEAD>
<BODY><BR><BR><CENTER>
<H1>CONVERTING - PLEASE WAIT!!!</H1>
</BODY>
</HTML>
error.aspx
<HTML>
<BODY><BR><BR><CENTER>
<H1>THERE WAS AN ERROR CONVERTING THE DOCUMENT</H1>
</BODY>
</HTML>
done.aspx
<HTML>
<BODY topMargin="0" leftMargin="0" scroll="no">
<EMBED src="<%= Request("docID") %>" width="100%" height="100%" fullscreen="yes">
</BODY>
</HTML>



Copyright © 1999-2016 Neevia Technology. All Rights Reserved. Home | Products | Technical Support | About Us | Contact Us