Skip to content

Commit

Permalink
Set MediaBox paramter for each page
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanheppenheimer authored and bsweeney committed Jan 9, 2016
1 parent 075f082 commit 57fecf6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/Cpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,8 @@ protected function o_page($id, $action, $options = '')
't' => 'page',
'info' => array(
'parent' => $this->currentNode,
'pageNum' => $this->numPages
'pageNum' => $this->numPages,
'mediaBox' => $this->objects[$this->currentNode]['info']['mediaBox']
)
);

Expand Down Expand Up @@ -1444,6 +1445,16 @@ protected function o_page($id, $action, $options = '')

case 'out':
$res = "\n$id 0 obj\n<< /Type /Page";
if (isset($o['info']['mediaBox'])) {
$tmp = $o['info']['mediaBox'];
$res .= "\n/MediaBox [" . sprintf(
'%.3F %.3F %.3F %.3F',
$tmp[0],
$tmp[1],
$tmp[2],
$tmp[3]
) . ']';
}
$res .= "\n/Parent " . $o['info']['parent'] . " 0 R";

if (isset($o['info']['annot'])) {
Expand Down

0 comments on commit 57fecf6

Please sign in to comment.