diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index 39920638d2..b5422a80c3 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -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& 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, + "<>\n", + aPageHandle ); + + closePdfObject(); + + return actionHandle; +} + + void PDF_PLOTTER::emitOutlineNode( OUTLINE_NODE* node, int parentHandle, int nextNode, int prevNode ) { diff --git a/include/plotters/plotters_pslike.h b/include/plotters/plotters_pslike.h index b0bf2fd89c..19cd2f6d11 100644 --- a/include/plotters/plotters_pslike.h +++ b/include/plotters/plotters_pslike.h @@ -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