I am trying to write a simple application fixing a flawed PDFs (delete 
unwanted pages, patch or create ToC - I mean the outline tree). So far, I have 
a Qt4 - PoDoFo - MuPDF app, which can read and display a PDFs. Thus, set 
out...

Task #1, delete ToC completely because we will create ToC from scratch. First 
attempt:

  PoDoFo::PdfMemDocument *doc = new PoDoFo::MemDocument;

<load ok>

  PoDoFo::PdfOutlines *root = doc->GetOutlines(false);

  if( root != nullptr ) root->Erase();    // GP fault

Okay, PdfOutlines is a derived class from PdfOutlineItem and I have already 
found out that it may be incomplete (for example, it has no label). Next 
attempt (delete outline items, not the root):

    if( root != nullptr )
    {
      PoDoFo::PdfOutlineItem *toc1 = toc->First();
      PoDoFo::PdfOutlineItem *toc2 = nullptr;

      while( toc1 != nullptr )
      {
        toc2 = toc1;
        toc1 = toc1->Next();

        toc2->Erase();    // GP fault
      }

Why?

The PDF is a small PDF 1.2. Operating system is Debian Wheezy KDE, PoDoFo 
0.9.1 (from the Debian repository). Memory 8 GB. It is known that the PDF has 
outline destinations defined by /GoTo actions.

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to