1665 |
raphael |
1 |
<?php
|
|
|
2 |
//============================================================+
|
|
|
3 |
// File name : tcpdf_import.php
|
|
|
4 |
// Version : 1.0.000
|
|
|
5 |
// Begin : 2011-05-23
|
|
|
6 |
// Last Update : 2013-03-17
|
|
|
7 |
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
|
|
8 |
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
|
|
|
9 |
// -------------------------------------------------------------------
|
|
|
10 |
// Copyright (C) 2011-2013 Nicola Asuni - Tecnick.com LTD
|
|
|
11 |
//
|
|
|
12 |
// This file is part of TCPDF software library.
|
|
|
13 |
//
|
|
|
14 |
// TCPDF is free software: you can redistribute it and/or modify it
|
|
|
15 |
// under the terms of the GNU Lesser General Public License as
|
|
|
16 |
// published by the Free Software Foundation, either version 3 of the
|
|
|
17 |
// License, or (at your option) any later version.
|
|
|
18 |
//
|
|
|
19 |
// TCPDF is distributed in the hope that it will be useful, but
|
|
|
20 |
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
21 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
22 |
// See the GNU Lesser General Public License for more details.
|
|
|
23 |
//
|
|
|
24 |
// You should have received a copy of the License
|
|
|
25 |
// along with TCPDF. If not, see
|
|
|
26 |
// <http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT>.
|
|
|
27 |
//
|
|
|
28 |
// See LICENSE.TXT file for more information.
|
|
|
29 |
// -------------------------------------------------------------------
|
|
|
30 |
//
|
|
|
31 |
// Description : This is a PHP class extension of the TCPDF library to
|
|
|
32 |
// import existing PDF documents.
|
|
|
33 |
//
|
|
|
34 |
//============================================================+
|
|
|
35 |
|
|
|
36 |
/**
|
|
|
37 |
* @file
|
|
|
38 |
* !!! THIS CLASS IS UNDER DEVELOPMENT !!!
|
|
|
39 |
* This is a PHP class extension of the TCPDF (http://www.tcpdf.org) library to import existing PDF documents.<br>
|
|
|
40 |
* @package com.tecnick.tcpdf
|
|
|
41 |
* @author Nicola Asuni
|
|
|
42 |
* @version 1.0.000
|
|
|
43 |
*/
|
|
|
44 |
|
|
|
45 |
// include the TCPDF class
|
|
|
46 |
require_once(dirname(__FILE__).'/tcpdf.php');
|
|
|
47 |
// include PDF parser class
|
|
|
48 |
require_once(dirname(__FILE__).'/tcpdf_parser.php');
|
|
|
49 |
|
|
|
50 |
/**
|
|
|
51 |
* @class TCPDF_IMPORT
|
|
|
52 |
* !!! THIS CLASS IS UNDER DEVELOPMENT !!!
|
|
|
53 |
* PHP class extension of the TCPDF (http://www.tcpdf.org) library to import existing PDF documents.<br>
|
|
|
54 |
* @package com.tecnick.tcpdf
|
|
|
55 |
* @brief PHP class extension of the TCPDF library to import existing PDF documents.
|
|
|
56 |
* @version 1.0.000
|
|
|
57 |
* @author Nicola Asuni - info@tecnick.com
|
|
|
58 |
*/
|
|
|
59 |
class TCPDF_IMPORT extends TCPDF {
|
|
|
60 |
|
|
|
61 |
/**
|
|
|
62 |
* Import an existing PDF document
|
|
|
63 |
* @param $filename (string) Filename of the PDF document to import.
|
|
|
64 |
* @return true in case of success, false otherwise
|
|
|
65 |
* @public
|
|
|
66 |
* @since 1.0.000 (2011-05-24)
|
|
|
67 |
*/
|
|
|
68 |
public function importPDF($filename) {
|
|
|
69 |
// load document
|
|
|
70 |
$rawdata = file_get_contents($filename);
|
|
|
71 |
if ($rawdata === false) {
|
|
|
72 |
$this->Error('Unable to get the content of the file: '.$filename);
|
|
|
73 |
}
|
|
|
74 |
// parse PDF data
|
|
|
75 |
$pdf = new TCPDF_PARSER($rawdata);
|
|
|
76 |
$data = $pdf->getParsedData();
|
|
|
77 |
// release some memory
|
|
|
78 |
unset($rawdata);
|
|
|
79 |
|
|
|
80 |
// ...
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
print_r($data); // DEBUG
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
unset($pdf);
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
} // END OF CLASS
|
|
|
90 |
|
|
|
91 |
//============================================================+
|
|
|
92 |
// END OF FILE
|
|
|
93 |
//============================================================+
|