forked from vuzit/vuzitphp
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathREADME
More file actions
158 lines (107 loc) · 4.69 KB
/
Copy pathREADME
File metadata and controls
158 lines (107 loc) · 4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
--------------------------------------------------
-- VuzitPHP, Vuzit Web Services library for PHP
--------------------------------------------------
--------------------------------------------------
-- INTRODUCTION
--------------------------------------------------
This is a library that allows developers to directly access the Vuzit Web
Service API through a simple PHP script:
http://vuzit.com/developer/documents_api
Below is a basic upload example:
<?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();
?>
To get started all you need to do is download the code, sign up for a free
account (https://ssl.vuzit.com/signup) and replace the public and
private keys with the keys from your account.
--------------------------------------------------
-- INITIAL SETUP
--------------------------------------------------
This application requires the PHP Client Library (libcurl):
http://php.net/curl
This link is to the installation instructions:
http://php.net/manual/en/curl.installation.php
A simple phpinfo() call will tell you if CURL is installed:
<?php
phpinfo();
?>
If you're using the Windows version then the library is an optional module.
Open your php.ini file and un-comment the following line:
extension=php_curl.dll
Then restart your web server. Verify with the phpinfo() call that it's
working. Sometimes on Windows machines the php.ini 'extension_dir' variable
is set to ./ which doesn't work. You will need to give it the full path.
In this example the PHP installation is stored in "C:\Program Files\php":
extension_dir = "C:/Program Files/php/ext"
--------------------------------------------------
-- GETTING STARTED
--------------------------------------------------
* Download the code - http://github.com/vuzit/vuzitphp/downloads
* Sign up for a free Vuzit account - https://ssl.vuzit.com/signup
* Code Examples - http://wiki.github.com/vuzit/vuzitphp/code_examples
* Vuzit API Reference - http://wiki.github.com/vuzit/vuzitphp/api_reference
--------------------------------------------------
-- EXAMPLES
--------------------------------------------------
Find Document Example - 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::findById("DOCUMENT_ID");
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 Example
<?php
include_once "VuzitPHP/lib/vuzit.php";
$doc = Vuzit_Document::upload("c:/temp/test.pdf");
$timestamp = time();
$sig = Vuzit_Service::signature("show", $doc->getId(), $timestamp);
?>
<html>
<head>
<link href="http://vuzit.com/stylesheets/Vuzit-2.9.css" rel="Stylesheet" type="text/css" />
<script src="http://vuzit.com/javascripts/Vuzit-2.9.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>
--------------------------------------------------
-- MORE INFORMATION
--------------------------------------------------
For more information, including installation visit:
http://vuzit.com/developer
--------------------------------------------------
-- LICENSE
--------------------------------------------------
Copyright (c) 2009 Brent Matzelle, Vuzit LLC
Released under the MIT license:
http://www.opensource.org/licenses/mit-license.php
This means you can use it in proprietary products. See LICENSE file.
--------------------------------------------------
-- Feature Requests and Bug Reports
--------------------------------------------------
Email to support AT vuzit DOT com