Hi,

I have tries with below podof - pdfinfo code:

In input pdf file, all outlines are having actions instead of destination.

void OutputOutlines(std::ostream& sOutStream, PoDoFo::PdfOutlineItem* pItem, 
int level )
{
    PoDoFo::PdfOutlines* pOutlines;
    int          i;

    if( !pItem )
    {
        pOutlines = mDoc->GetOutlines( PoDoFo::ePdfDontCreateObject );
        if ( !pOutlines || !pOutlines->First() ) {
            sOutStream << "\tNone Found" << std::endl;
            return;
        }
        pItem     = pOutlines->First();
    }

    for( i=0;i<level;i++ )
        sOutStream << "-";

    sOutStream << ">" << pItem->GetTitle().GetString();
    PoDoFo::PdfDestination* pDest = pItem->GetDestination( mDoc );
    if ( pDest ) {   // then it's a destination

        PoDoFo::PdfPage* pPage = pDest->GetPage( mDoc );
        if( pPage )
            sOutStream << "\tDestination: Page #" << pPage->GetPageNumber();
        else
            sOutStream << "\tDestination: Page #" << "???";

    } else {
              // then it's one or more actions
            sOutStream << "\tAction: " << "???";
            PdfAction* action = pItem->GetAction();
            PdfObject *object = action->GetObject();
            PdfDictionary dictionary = object->GetDictionary();
            if(dictionary.HasKey(PdfName("D")))//Getting Access violation error.
            {

            }
    }
    sOutStream << std::endl;

    if( pItem->First() )
        OutputOutlines( sOutStream, pItem->First(), level+1 );

    if( pItem->Next() )
        OutputOutlines( sOutStream, pItem->Next(), level );
}

My pdf content:
62 0 obj
<</A 63 0 R/Parent 60 0 R/Prev 61 0 R/Title(Topic2)>>
endobj
63 0 obj
<</D[9 0 R/FitH 847]/S/GoTo>>
endobj

What is wrong with above my code ?

Regards,
Dinesh

From: Dineshkumar Ramalingam
Sent: 09 May 2015 15:28
To: 'podofo-users@lists.sourceforge.net'
Subject: Reg: Retrieve Bookmarks from PDF in PoDoFo

Hi,

I am new to the PoDoFo library.

Here I am getting bookmark information from PDF file by using PoDoFo Library, 
but I don't know how to get destination details from pdfDestination/pdfAction 
object.

PdfMemDocument *pdfDoc = new 
PdfMemDocument("C:\\Users\\dineshkumar.r\\Documents\\Bookmarks - 691.pdf");
       PdfOutlines* outlines = pdfDoc->GetOutlines();
       PdfOutlineItem* root = outlines->First();
       PdfOutlineItem* outline = outlines->First();

       while(outline != NULL)
       {
              PdfString title = outline->GetTitle();
              printf("Outline Title %s", title.GetString());
              PdfDestination* des = outline->GetDestination(pdfDoc);
              if(des != NULL)
              {
                     PdfPage* page = des->GetPage(&pdfDoc->GetObjects());
                     if(page != NULL)
                           int pageNo = page->GetPageNumber();
              }
              else
              {
                     PdfAction* action = outline->GetAction();
                     EPdfAction actionType = 
(EPdfAction)action->GetType();//ePdfAction_GoTo
                     PdfObject *object = action->GetObject();
                     PdfDictionary dictionary = object->GetDictionary();
                     if(action->HasScript())
                     {
                           PdfString script = action->GetScript();
                     }
                     if(action->HasURI())
                     {
                           PdfString s = action->GetURI();
                     }
              }
              outline = root->Next();
       }

Kindly help me to resolve the issues with my code.

Regards,
Dinesh


::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information 
could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in 
transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on 
the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the 
author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, 
dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written 
consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please 
delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and 
other defects.

----------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to