-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.php
127 lines (120 loc) · 4.65 KB
/
test.php
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
<?php
/*
* This is just a test page for the API Wrapper.
*/
if(isset($_POST['url']) || isset($_POST['function'])) {
include("simplehtmltopdf-api.php");
$api = new SimpleHTMLToPDF();
switch ($_POST['function']) {
case 'display':
$api->display(
urldecode($_POST['url']),
$_POST['orientation'],
array(
$_POST['mtop'],
$_POST['mleft'],
$_POST['mright'],
$_POST['mbot']
));
break;
case 'download':
$api->download(
urldecode($_POST['url']),
$_POST['orientation'],
array(
$_POST['mtop'],
$_POST['mleft'],
$_POST['mright'],
$_POST['mbot']
));
break;
default:
$api->display(urldecode($_POST["url"]));
break;
}
} else {
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test page for Simple HTML to PDF Wrapper</title>
<style>
.code {
font-family: monospace;
margin: 0;
padding: 0;
}
.string { color: #00B000; }
.function { color: #0093FF; }
.var { color: #8C8C8C; }
.class { color: #00E4AC; }
</style>
</head>
<body>
<!--<form method="POST" action="">
<label for="url">Get this page : </label>
<input type="text" name="url" id="url">
<input type="submit" value="Go !">
</form>-->
<h1>SimpleHTMLToPDF API Wrapper test page</h1>
<p>
This page help you understand how to use this API Wrapper.<br>
Each form show you how to use each function and what parameters you should pass to these.<br>
Play with it and be sure to check the GitHub repository : <a href="https://github.com/AMDG2/SimpleHTMLToPDF-API-Wrapper">https://github.com/AMDG2/SimpleHTMLToPDF-API-Wrapper</a>
</p>
<form method="POST" action="">
<fieldset><legend>The display function</legend>
<input type="hidden" name="function" value="display">
<span class="function">include</span>(<span class="string">"simplehtmltopdf-api.php"</span>);<br>
<span class="var">$api</span> = <span class="function">new</span> <span class="class">SimpleHTMLToPDF</span>();
<div class="code">
<label for="url"><span class="var">$api</span>-><span class="function">display</span>(</label>
<input type="text" name="url" id="url" placeholder="http://www.simplehtmltopdf.com/" required style="width: 15em;">
<label for="orientation">, orientation = </label>
<select name="orientation" id="orientation">
<option value="Portrait">Portrait</option>
<option value="Landscape">Landscape</option>
</select>
, margins = <span class="function">array</span>(
<label for="mtop">Top = </label>
<input type="number" name="mtop" id="mtop" placeholder="Top" style="width: 3em;" value="10">,
<label for="mleft">Left = </label>
<input type="number" name="mleft" id="mleft" placeholder="Left" style="width: 3em;" value="10">,
<label for="mright">Right = </label>
<input type="number" name="mright" id="mright" placeholder="Right" style="width: 3em;" value="10">,
<label for="mbot">Bottom = </label>
<input type="number" name="mbot" id="mbot" placeholder="Bottom" style="width: 3em;" value="10">));
<input type="submit" value="Send Request">
</div>
</fieldset>
</form>
<form method="POST" action="">
<fieldset><legend>The download function</legend>
<input type="hidden" name="function" value="download">
<span class="function">include</span>(<span class="string">"simplehtmltopdf-api.php"</span>);<br>
<span class="var">$api</span> = <span class="function">new</span> <span class="class">SimpleHTMLToPDF</span>();
<div class="code">
<label for="url"><span class="var">$api</span>-><span class="function">download</span>(</label>
<input type="text" name="url" id="url" placeholder="http://www.simplehtmltopdf.com/" required style="width: 15em;">
<label for="orientation">, orientation = </label>
<select name="orientation" id="orientation">
<option value="Portrait">Portrait</option>
<option value="Landscape">Landscape</option>
</select>
, margins = <span class="function">array</span>(
<label for="mtop">Top = </label>
<input type="number" name="mtop" id="mtop" placeholder="Top" style="width: 3em;" value="10">,
<label for="mleft">Left = </label>
<input type="number" name="mleft" id="mleft" placeholder="Left" style="width: 3em;" value="10">,
<label for="mright">Right = </label>
<input type="number" name="mright" id="mright" placeholder="Right" style="width: 3em;" value="10">,
<label for="mbot">Bottom = </label>
<input type="number" name="mbot" id="mbot" placeholder="Bottom" style="width: 3em;" value="10">));
<input type="submit" value="Send Request">
</div>
</fieldset>
</form>
</body>
</html>
<?php } ?>