|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is based on code of tecnickcom/TCPDF PDF library. |
|
5
|
|
|
* |
|
6
|
|
|
* Original author Nicola Asuni ([email protected]) and |
|
7
|
|
|
* contributors (https://github.com/tecnickcom/TCPDF/graphs/contributors). |
|
8
|
|
|
* |
|
9
|
|
|
* @see https://github.com/tecnickcom/TCPDF |
|
10
|
|
|
* |
|
11
|
|
|
* Original code was licensed on the terms of the LGPL v3. |
|
12
|
|
|
* |
|
13
|
|
|
* ------------------------------------------------------------------------------ |
|
14
|
|
|
* |
|
15
|
|
|
* @file This file is part of the PdfParser library. |
|
16
|
|
|
* |
|
17
|
|
|
* @author Alastair Irvine <[email protected]> |
|
18
|
|
|
* |
|
19
|
|
|
* @date 2024-01-12 |
|
20
|
|
|
* |
|
21
|
|
|
* @license LGPLv3 |
|
22
|
|
|
* |
|
23
|
|
|
* @url <https://github.com/smalot/pdfparser> |
|
24
|
|
|
* |
|
25
|
|
|
* PdfParser is a pdf library written in PHP, extraction oriented. |
|
26
|
|
|
* Copyright (C) 2017 - Sébastien MALOT <[email protected]> |
|
27
|
|
|
* |
|
28
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
29
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
|
30
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
|
31
|
|
|
* (at your option) any later version. |
|
32
|
|
|
* |
|
33
|
|
|
* This program is distributed in the hope that it will be useful, |
|
34
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
35
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
36
|
|
|
* GNU Lesser General Public License for more details. |
|
37
|
|
|
* |
|
38
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
|
39
|
|
|
* along with this program. |
|
40
|
|
|
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>. |
|
41
|
|
|
*/ |
|
42
|
|
|
|
|
43
|
|
|
namespace Smalot\PdfParser\RawData; |
|
44
|
|
|
|
|
45
|
|
|
class DataHelper |
|
46
|
|
|
{ |
|
47
|
|
|
/* |
|
48
|
|
|
* Decode a string of the form "15_0" into an array. |
|
49
|
|
|
* |
|
50
|
|
|
* @param string $objRef The object ID |
|
51
|
|
|
* @return array object number and generation |
|
52
|
|
|
* |
|
53
|
|
|
* @throws \Exception if @p $objRef is invalid |
|
54
|
|
|
*/ |
|
55
|
|
|
public static function decodeRef(string $objRef): array |
|
56
|
|
|
{ |
|
57
|
|
|
$objRefArr = \explode('_', $objRef); |
|
58
|
|
|
if (2 !== \count($objRefArr)) { |
|
59
|
|
|
throw new \Exception('Invalid object reference for $obj.'); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
return $objRefArr; |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|