Seems podofomerge is supposed to merge also outlines through using
PdfDocument::Append:
// append all outlines
> PdfOutlineItem* pRoot = this->GetOutlines();
> PdfOutlines* pAppendRoot = const_cast<PdfMemDocument&>(rDoc).
> GetOutlines( PoDoFo::ePdfDontCreateObject );
> if( pAppendRoot && pAppendRoot->First() )
> {
> // only append outlines if appended document has outlines
> while( pRoot && pRoot->Next() )
> pRoot = pRoot->Next();
>
> PdfReference ref( pAppendRoot->First()->GetObject()->Reference
> ().ObjectNumber() + difference, pAppendRoot->First()->GetObject()->
> Reference().GenerationNumber() );
> pRoot->InsertChild( new PdfOutlines( m_vecObjects.GetObject(
> ref ) ) );
> }
but this is not working because m_pLast of root is not properly set during
load, it is NULL and original last item will not have next key set to first
outline item of appended pdf so items are appended into merged pdf file but
are not shown in reader.
PdfOutlineItem::InsertChild:
if( m_pLast )
> {
> m_pLast->SetNext( pItem );
> pItem->SetPrevious( m_pLast );
> }
Seems m_pLast is NULL because m_pParentOutline is not tracked properly
during construction in PdfOutlineItem::PdfOutlineItem:
if( this->GetObject()->GetDictionary().HasKey( "First" ) )
>
>> {
>
>> first = this->GetObject()->GetDictionary().GetKey("First")->
> GetReference();
>
>> m_pFirst = new PdfOutlineItem( pObject->GetOwner()->GetObject(
> first ), this, NULL );
>
>> }
>
>> if( this->GetObject()->GetDictionary().HasKey( "Next" ) )
>
>> {
>
>> next = this->GetObject()->GetDictionary().GetKey("Next")->
> GetReference();
>
>> PdfObject* pObj = pObject->GetOwner()->GetObject( next );
>
>> m_pNext = new PdfOutlineItem( pObj, *NULL*, this );
>
>> }
>
>> else
>
>> {
>
>> // if there is no next key,
>
>> // we have to set ourself as the last item of the parent
>
>> if( *m_pParentOutline* )
>
>> m_pParentOutline->SetLast( this );
> }
So last top level item will have parent set to NULL (more precisely each
item which is not first in level) and so it will not set m_pLast of its
parent. Maybe that one line should be:
m_pNext = new PdfOutlineItem( pObj, *m_pParentOutline*, this );
Next item should inherit same parent.
Also seems functions like PdfOutlineItem::CreateChild and PdfOutlines
::CreateRoot are not working.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users