From f6f133eb09532943976cd38d40d794a008bbccc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Wed, 10 Aug 2011 14:33:03 +0200 Subject: [PATCH] Avoid duplicating bookmark code from TCPDF, where it works --- .../schema/Pdf_Relation_Schema.class.php | 100 ------------------ 1 file changed, 100 deletions(-) diff --git a/libraries/schema/Pdf_Relation_Schema.class.php b/libraries/schema/Pdf_Relation_Schema.class.php index 43eb57d838..f65fcc2c3f 100644 --- a/libraries/schema/Pdf_Relation_Schema.class.php +++ b/libraries/schema/Pdf_Relation_Schema.class.php @@ -240,106 +240,6 @@ class PMA_Schema_PDF extends PMA_PDF } } - /** - * Add a bookmark - */ - function Bookmark($txt, $level = 0, $y = 0, $page = '') - { - $this->Outlines[0][] = $level; - $this->Outlines[1][] = $txt; - $this->Outlines[2][] = $this->page; - if ($y == -1) { - $y = $this->GetY(); - } - $this->Outlines[3][] = round($this->hPt - $y * $this->k, 2); - } - - function _putbookmarks() - { - if (count($this->Outlines) > 0) { - // Save object number - $memo_n = $this->n; - // Take the number of sub elements for an outline - $nb_outlines = sizeof($this->Outlines[0]); - $first_level = array(); - $parent = array(); - $parent[0] = 1; - for ($i = 0; $i < $nb_outlines; $i++) { - $level = $this->Outlines[0][$i]; - $kids = 0; - $last = -1; - $prev = -1; - $next = -1; - if ($i > 0) { - $cursor = $i-1; - // Take the previous outline in the same level - while ($this->Outlines[0][$cursor] > $level && $cursor > 0) - $cursor--; - if ($this->Outlines[0][$cursor] == $level) { - $prev = $cursor; - } - } - if ($i < $nb_outlines-1) { - $cursor = $i + 1; - while (isset($this->Outlines[0][$cursor]) && $this->Outlines[0][$cursor] > $level) { - // Take the immediate kid in level + 1 - if ($this->Outlines[0][$cursor] == $level + 1) { - $kids++; - $last = $cursor; - } - $cursor++; - } - $cursor = $i + 1; - // Take the next outline in the same level - while ($this->Outlines[0][$cursor] > $level && ($cursor + 1 < sizeof($this->Outlines[0]))) - $cursor++; - if ($this->Outlines[0][$cursor] == $level) { - $next = $cursor; - } - } - $this->_newobj(); - $parent[$level + 1] = $this->n; - if ($level == 0) { - $first_level[] = $this->n; - } - $this->_out('<<'); - $this->_out('/Title (' . $this->Outlines[1][$i] . ')'); - $this->_out('/Parent ' . $parent[$level] . ' 0 R'); - if ($prev != -1) { - $this->_out('/Prev ' . ($memo_n + $prev + 1) . ' 0 R'); - } - if ($next != -1) { - $this->_out('/Next ' . ($this->n + $next - $i) . ' 0 R'); - } - $this->_out('/Dest [' . (1 + (2 * $this->Outlines[2][$i])) . ' 0 R /XYZ null ' . $this->Outlines[3][$i] . ' null]'); - if ($kids > 0) { - $this->_out('/First ' . ($this->n + 1) . ' 0 R'); - $this->_out('/Last ' . ($this->n + $last - $i) . ' 0 R'); - $this->_out('/Count -' . $kids); - } - $this->_out('>>'); - $this->_out('endobj'); - } - // First page of outlines - $this->_newobj(); - $this->def_outlines = $this->n; - $this->_out('<<'); - $this->_out('/Type'); - $this->_out('/Outlines'); - $this->_out('/First ' . $first_level[0] . ' 0 R'); - $this->_out('/Last ' . $first_level[sizeof($first_level)-1] . ' 0 R'); - $this->_out('/Count ' . sizeof($first_level)); - $this->_out('>>'); - $this->_out('endobj'); - } - } - - function _putresources() - { - parent::_putresources(); - $this->_putbookmarks(); - } - function SetWidths($w) { // column widths