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 PHP  Print Example 
Note: Copy these PHP scripts (main.php, checkstatus.php, error.php and done.php) into your web site root.

Main.php
<?php
  if ($_REQUEST["urlToConvert"] != "") {
    $DC = New COM("Neevia.docConverter");

    $DC->setParameter( "DocumentOutputFormat", "PDF" );
    $DC->setParameter( "DocumentOutputFolder", realpath(".") );
    $DC->setParameter( "PDFAutoRotatePage", "All" );

    $docID = $DC->GUID . ".url";
    $rVal = $DC->submitURL($_REQUEST["urlToConvert"], $docID, "");

    if ($rVal != 0 ) {
       header("Location: error.php");
    }else{
       header("Location: checkStatus.php?docID=" . $docID);
    }
  }
?>
<HTML>
<HEAD>
  <TITLE>Neevia Document Converter Pro sample file</TITLE>
</HEAD>
<BODY><CENTER>
<FORM action="main.php">
URL to convert:
<INPUT type="input" name="urlToConvert" value="http://neevia.com"><BR>
<INPUT type="submit" name="submit" value="Convert URL">
</FORM>
</BODY>
</HTML>
checkStatus.php
<?php
  $DC = New COM("Neevia.docConverter");

  $DC->setParameter("DocumentOutputFolder", realpath("."));

  $docID=$_REQUEST["docID"];

  $rVal = $DC->checkStatus($docID, "");
  if ($rVal==0){
    header("Location: done.php?docID=". $DC->getBaseName( $docID ));
  } else {
    if ($rVal != 2) { header("Location: error.php"); }
  }
?>
<HTML>
<HEAD>
 <TITLE>Neevia.com</TITLE>
 <META HTTP-EQUIV="refresh" CONTENT="2">
</HEAD>
<BODY><BR><BR><CENTER>
<H1>CONVERTING - PLEASE WAIT!!!</H1>
</BODY>
</HTML>
error.php
<HTML>
<BODY><BR><BR><CENTER>
<H1>THERE WAS AN ERROR CONVERTING THE DOCUMENT</H1>
</BODY>
</HTML>
done.php
<HTML>
<BODY topMargin="0" leftMargin="0" scroll="no">
<EMBED src="<?php echo $_REQUEST["docID"] . ".pdf" ?>" width="100%" height="100%" 
       fullscreen="yes">
</BODY>
</HTML>



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