forked from AdrianCavazos/RES-PV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pdf_js.php
44 lines (38 loc) · 1.07 KB
/
pdf_js.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
<?php
require(__DIR__.'/tfpdf.php');
class PDF_JavaScript extends tFPDF {
protected $javascript;
protected $n_js;
function IncludeJS($script, $isUTF8=false) {
if(!$isUTF8)
$script=utf8_encode($script);
$this->javascript=$script;
}
function _putjavascript() {
$this->_newobj();
$this->n_js=$this->n;
$this->_put('<<');
$this->_put('/Names [(EmbeddedJS) '.($this->n+1).' 0 R]');
$this->_put('>>');
$this->_put('endobj');
$this->_newobj();
$this->_put('<<');
$this->_put('/S /JavaScript');
$this->_put('/JS '.$this->_textstring($this->javascript));
$this->_put('>>');
$this->_put('endobj');
}
function _putresources() {
parent::_putresources();
if (!empty($this->javascript)) {
$this->_putjavascript();
}
}
function _putcatalog() {
parent::_putcatalog();
if (!empty($this->javascript)) {
$this->_put('/Names <</JavaScript '.($this->n_js).' 0 R>>');
}
}
}
?>