Bug 104081 - kpdf doesn't recognize commands for expanding table of contents
Summary: kpdf doesn't recognize commands for expanding table of contents
Status: RESOLVED FIXED
Alias: None
Product: kpdf
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Albert Astals Cid
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-17 20:23 UTC by Mikolaj Machowski
Modified: 2007-04-16 21:12 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
bol.pdf (33.69 KB, application/pdf)
2005-06-03 15:05 UTC, Mikolaj Machowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikolaj Machowski 2005-04-17 20:23:09 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

kpdf doesn't recognize commands for expanding table of contents pdfbookmarksopen, pdfbookmarksopenlevel commands from hyperref package
Comment 1 Albert Astals Cid 2005-04-17 20:44:01 UTC
These actions are not part of pdf 1.6 specification so that's a wish and not a bug
Comment 2 Mikolaj Machowski 2005-04-18 09:14:53 UTC
> These actions are not part of pdf 1.6 specification so that's a
> wish and not a bug


Hyperref creates PDF1.3 so it is hard believable these commands are not
in 1.6 . Note: bookmarksopen and bookmarksopenlevel are _hyperref_
commands, not PDF.
Comment 3 Albert Astals Cid 2005-04-18 10:40:01 UTC
You said it, they are _hyperref_ commands and not PDF, so they are not in the PDF spec, the PDF spec defines a few named actions and says "you have to implement that to be pdf compliant" and then says "other viewers/generators may implement other named actions but they have to keep in mind they are not going to be standard"

So as i said this is a wish
Comment 4 Albert Astals Cid 2005-06-02 19:54:07 UTC
btw having a document that uses that commands but be nice for testing
Comment 5 Mikolaj Machowski 2005-06-03 00:26:16 UTC
> btw having a document that uses that commands but be nice for testing


http://skawina.eu.org/mikolaj/vst.pdf
Comment 6 Albert Astals Cid 2005-06-03 00:45:25 UTC
And should i find in a 31 page document where the link having that command is?
Comment 7 Mikolaj Machowski 2005-06-03 15:05:59 UTC
> And should i find in a 31 page document where the link having
> that command is?


What link? This is property of PDF document. If you want smaller
document here it is.


Created an attachment (id=11312)
bol.pdf
Comment 8 Rudolf Maurer 2005-06-03 15:16:13 UTC
Maybe this helps to clarify:
Yes, if you are using pdftex and hyperref to generate the pdf hyperref is responsible for creating this property of the future pdf-doc.
So it is in the Doc and it is of PDF v.1.3 (Acrobat 4.x)
My Win$$-Acrobat does what it should: Open the document with the Bookmark-Panel open and expanded bookmark-tree. 

Kpdf does not do that.

bye,
Rudy
Comment 9 Mikolaj Machowski 2005-06-03 20:19:15 UTC
> My Win$$-Acrobat does what it should: Open the document with the
> Bookmark-Panel open and expanded bookmark-tree.

Even xpdf (3.0 - didn't try earrlier versions) does that.
Comment 10 Al Muckart 2006-09-29 03:30:50 UTC
I can confirm this. Currently kpdf is the only pdf viewer I have found which does not expand the bookmarks and set the initial view as specified in the hyperref config.
Comment 11 Albert Astals Cid 2006-10-28 19:44:24 UTC
Ok, now that i understood the whole thing, this IS a bug, let's see if we can get it fixed.
Comment 12 Pino Toscano 2007-04-16 21:12:39 UTC
SVN commit 654682 by pino:

React to the commands for opening the TOC pane, and for expanding the subtrees of the TOC.

BUG: 104081


 M  +8 -0      core/generator_pdf/generator_pdf.cpp  
 M  +5 -0      part.cpp  
 M  +8 -0      ui/toc.cpp  


--- branches/KDE/3.5/kdegraphics/kpdf/core/generator_pdf/generator_pdf.cpp #654681:654682
@@ -15,6 +15,7 @@
 #include <qapplication.h>
 #include <qpaintdevicemetrics.h>
 #include <qregexp.h>
+#include <qvariant.h>
 #include <kapplication.h>
 #include <klistview.h>
 #include <klocale.h>
@@ -582,6 +583,11 @@
         if ( viewport.pageNumber >= 0 )
             return viewport.toString();
     }
+    else if ( key == "OpenTOC" )
+    {
+        if ( pdfdoc->getCatalog()->getPageMode() == Catalog::UseOutlines )
+            return "yes";
+    }
     return QString();
 }
 
@@ -866,6 +872,8 @@
             }
         }
 
+        item.setAttribute( "Open", QVariant( (bool)outlineItem->isOpen() ).toString() );
+
         // 3. recursively descend over children
         outlineItem->open();
         GList * children = outlineItem->getKids();
--- branches/KDE/3.5/kdegraphics/kpdf/part.cpp #654681:654682
@@ -470,6 +470,11 @@
     if ( !m_watcher->contains(m_file) )
         m_watcher->addFile(m_file);
 
+    // if the 'OpenTOC' flag is set, open the TOC
+    if ( m_document->getMetaData( "OpenTOC" ) == "yes" && m_toolBox->isItemEnabled( 0 ) )
+    {
+        m_toolBox->setCurrentIndex( 0 );
+    }
     // if the 'StartFullScreen' flag is set, start presentation
     if ( m_document->getMetaData( "StartFullScreen" ) == "yes" )
     {
--- branches/KDE/3.5/kdegraphics/kpdf/ui/toc.cpp #654681:654682
@@ -9,6 +9,7 @@
 
 // qt/kde includes
 #include <qheader.h>
+#include <qvariant.h>
 #include <klocale.h>
 
 // local includes
@@ -121,6 +122,13 @@
         // descend recursively and advance to the next node
         if ( e.hasChildNodes() )
             addChildren( n, currentItem );
+
+        // open/keep close the item
+        bool isOpen = false;
+        if ( e.hasAttribute( "Open" ) )
+            isOpen = QVariant( e.attribute( "Open" ) ).toBool();
+        currentItem->setOpen( isOpen );
+
         n = n.nextSibling();
     }
 }