Skip to content
This repository

Below are a few simple examples.

Upload Example

Below is an example that shows how include Vuzit and upload a simple file:


  <?php
  include_once "VuzitPHP/lib/vuzit.php";

  Vuzit_Service::setPublicKey('YOUR_PUBLIC_API_KEY');
  Vuzit_Service::setPrivateKey('YOUR_PRIVATE_API_KEY');

  $doc = Vuzit_Document::upload("c:/path/to/document.pdf");
  echo "Document id: " . $doc->getId();
  ?>

Load Document Example

Below shows how to load a document.


  <?php
  include_once "VuzitPHP/lib/vuzit.php";

  Vuzit_Service::setPublicKey('YOUR_PUBLIC_API_KEY');
  Vuzit_Service::setPrivateKey('YOUR_PRIVATE_API_KEY');';

  $doc = Vuzit_Document::find("DOCUMENT_ID");
  echo "Document id: " . $doc->getId();
  echo "Document title: " . $doc->getTitle();
  ?>

Search Documents Example:


Vuzit_Service::setPublicKey('YOUR_PUBLIC_API_KEY');
Vuzit_Service::setPrivateKey('YOUR_PRIVATE_API_KEY');

$docs = Vuzit_Document::findAll(array("query" => "john smith", "limit" => 5));

foreach($docs as $doc)
{
  echo "Document id: " . $doc->getId();
  echo "Document title: " . $doc->getTitle();
}

Delete (destroy) Document Example:


  <?php
  include_once "VuzitPHP/lib/vuzit.php";

  Vuzit_Service::setPublicKey('YOUR_PUBLIC_API_KEY');
  Vuzit_Service::setPrivateKey('YOUR_PRIVATE_API_KEY');

  Vuzit_Document::destroy("DOCUMENT_ID");
  ?>

Upload and View with the JavaScript API


  <?php
  include_once "VuzitPHP/lib/vuzit.php";

  Vuzit_Service::setPublicKey('YOUR_PUBLIC_API_KEY');
  Vuzit_Service::setPrivateKey('YOUR_PRIVATE_API_KEY');

  $doc = Vuzit_Document::upload("c:/temp/test.pdf");
  $timestamp = time();
  $sig = Vuzit_Service::signature("show", $doc->getId(), $timestamp);
  ?>
  <html>
    <head>
      <link href="https://ssl.vuzit.com/stylesheets/Vuzit-2.10.css" rel="Stylesheet" type="text/css" />
      <script src="https://ssl.vuzit.com/javascripts/Vuzit-2.10.js" type="text/javascript"></script>
      <script type="text/javascript">
        // Called when the page is loaded.  
        function initialize()  {
          vuzit.Base.apiKeySet("<?php echo Vuzit_Service::getPublicKey(); ?>"); 
          var options = {signature: '<?php echo rawurlencode($sig); ?>', 
                         timestamp: '<?php echo $timestamp ?>', ssl: true}
          var viewer = vuzit.Viewer.fromId("<?php echo $doc->getId(); ?>", options);

          viewer.display(document.getElementById("vuzit_viewer"), { zoom: 1 });
        }
      </script>
    </head>
    <body onload="initialize()">
      <div id="vuzit_viewer" style="width: 650px; height: 500px;"></div>
    </body>
  </html>

Something went wrong with that request. Please try again.