2012-09-12 2 views

답변

1

Zend Framework, 특히 Zend_Pdf 구성 요소를 살펴볼 수 있습니다. 자신의 매뉴얼 페이지에서

:

$pdf = Zend_Pdf::load($pdfPath); 

echo $pdf->properties['Title'] . "\n"; 
echo $pdf->properties['Author'] . "\n"; 

$pdf->properties['Title'] = 'New Title.'; 
$pdf->save($pdfPath); 

HTH

+0

고마워,하지만 난 여분의 라이브러리없이 해결책을 찾고 있는데. –

1

방금 ​​폭과 높이를 원하는 경우,이 점에서 당신에게 높이와 폭을 줄 것이다

<?php 

$pdffile = "filename.pdf"; 
$pdfinfo = shell_exec("pdfinfo ".$pdffile); 

// find height and width 
preg_match('/Page size:\s+([0-9]{0,5}\.?[0-9]{0,3}) x ([0-9]{0,5}\.?[0-9]{0,3})/', $pdfinfo,$heightandwidth); 
$width = $heightandwidth[1]; 
$height = $heightandwidth[2]; 

?> 

사용합니다. 그러면 원하는 단위로 변환 할 수있는 간단한 수학을 할 수 있습니다.

+0

좋은데, 나에게 일하지 마라. –

+0

hum ... pdfinfo는 도서관에서 명령이다. :( –

2

ImageMagick understands PDF'sImagick::identifyImage()은 많은 정보가있는 배열을 반환합니다.

이 조각 :

$img = new Imagick('test.pdf'); 
var_dump($img->identifyImage()); 

이 렌더링 생성 :

array(9) { 
    ["imageName"]=> 
    string(9) "/test.pdf" 
    ["format"]=> 
    string(30) "PDF (Portable Document Format)" 
    ["geometry"]=> 
    array(2) { 
    ["width"]=> 
    int(596) 
    ["height"]=> 
    int(843) 
    } 
    ["resolution"]=> 
    array(2) { 
    ["x"]=> 
    float(72) 
    ["y"]=> 
    float(72) 
    } 
    ["units"]=> 
    string(9) "Undefined" 
    ["type"]=> 
    string(14) "TrueColorMatte" 
    ["colorSpace"]=> 
    string(3) "RGB" 
    ["compression"]=> 
    string(9) "Undefined" 
    ["fileSize"]=> 
    string(7) "37.6KBB" 
}