Make the page outline nodes goto page...

This commit is contained in:
Marek Roszko 2022-09-24 23:36:03 -04:00
parent 209e1b2086
commit 0595efd0a7
2 changed files with 21 additions and 2 deletions

View File

@ -822,13 +822,15 @@ void PDF_PLOTTER::ClosePage()
}
OUTLINE_NODE* pageOutlineNode = addOutlineNode( m_outlineRoot.get(), -1, pageOutlineName );
int actionHandle = emitGoToAction( pageHandle );
OUTLINE_NODE* pageOutlineNode =
addOutlineNode( m_outlineRoot.get(), actionHandle, pageOutlineName );
// let's reorg the symbol bookmarks under a page handle
// let's reorg the symbol bookmarks under a page handle
for( const auto& [groupName, groupVector] : m_bookmarksInPage )
{
OUTLINE_NODE* groupOutlineNode = addOutlineNode( pageOutlineNode, -1, groupName );
OUTLINE_NODE* groupOutlineNode = addOutlineNode( pageOutlineNode, actionHandle, groupName );
for( const std::pair<BOX2I, wxString>& bookmarkPair : groupVector )
{
@ -919,6 +921,22 @@ int PDF_PLOTTER::emitGoToAction( int aPageHandle, const VECTOR2I& aBottomLeft,
}
int PDF_PLOTTER::emitGoToAction( int aPageHandle )
{
int actionHandle = allocPdfObject();
startPdfObject( actionHandle );
fprintf( m_outputFile,
"<</S /GoTo /D [%d 0 R /Fit]\n"
">>\n",
aPageHandle );
closePdfObject();
return actionHandle;
}
void PDF_PLOTTER::emitOutlineNode( OUTLINE_NODE* node, int parentHandle, int nextNode,
int prevNode )
{

View File

@ -464,6 +464,7 @@ protected:
* @return Generated action handle
*/
int emitGoToAction( int aPageHandle, const VECTOR2I& aBottomLeft, const VECTOR2I& aTopRight );
int emitGoToAction( int aPageHandle );
int m_pageTreeHandle; ///< Handle to the root of the page tree object
int m_fontResDictHandle; ///< Font resource dictionary