Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- httpd 2.2.32
- Node.js apache 연동
- node.js
- PHP 5.2 .ini
- Mod_Security 룰 셋
- httpd-vhosts.conf
- apache 연동
- unique_id
- httpd.conf
- vim color scheme
- vimrc 옵션
- CentOS
- CentOS 6.10
- httpd-mpm.conf
- MySQL
- MySQL 5.1.41
- httpd-dav.conf
- httpd-autoindex.conf
- jQuery
- python 3.X 소스 설치
- python 3.5.10
- epel repository
- httpd-info.conf
- PHP 5.2.17 .ini
- mod_unique_id
- Node.js 소스 설치
- Repository
- gcc update
- httpd-default.conf
- CentOS 6
Archives
- Today
- Total
곰시기's
[PHP] - pdf 속성 추출 본문
function get_pdf_prop( $file ) {
$f = fopen($file,'rb');
if( !$f ) return false;
//Read the last 16KB
fseek( $f, -16384, SEEK_END );
$s = fread( $f, 16384 );
//Extract cross-reference table and trailer
if( !preg_match( "/xref[\r\n]+(.*)trailer(.*)startxref/s", $s, $a ) ) return false;
$xref = $a[1];
$trailer = $a[2];
//Extract Info object number
if( !preg_match( '/Info ([0-9]+) /', $trailer, $a ) ) return false;
$object_no = $a[1];
//Extract Info object offset
$lines = preg_split( "/[\r\n]+/", $xref );
$line = $lines[1 + $object_no];
$offset = (int)$line;
if( $offset == 0 ) return false;
//Read Info object
fseek( $f, $offset, SEEK_SET );
$s = fread( $f, 1024 );
fclose( $f );
//Extract properties
if( !preg_match( '/<<(.*)>>/Us', $s, $a ) )
return false;
$n = preg_match_all( '|/([a-z]+) ?\((.*)\)|Ui', $a[1], $a );
$prop = array();
for( $i=0; $i<$n; $i++ ) {
$prop[$a[1][$i]] = $a[2][$i];
}
return $prop;
}
출처 - http://www.fpdf.org/en/script/script59.php'Web Development > PHP' 카테고리의 다른 글
[PHP] - 페이징 함수 (0) | 2021.03.01 |
---|---|
[PHP] - Select Box (0) | 2021.02.16 |
[PHP] - JsonEncoder 함수 (0) | 2021.02.16 |
[PHP] - 간단한 iconv 함수 (0) | 2021.02.16 |
[PHP] - 원격지 파일 다운로드 (0) | 2021.02.16 |
Comments