[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-poppler
Subject:    Re: [poppler] API for outline/table of contents modification
From:       rm+popplerlist () arcsin ! org
Date:       2021-05-03 5:04:30
Message-ID: 6e4fa624-802b-4865-d314-0033ca1db6ed () arcsin ! org
[Download RAW message or body]

Oliver,

     I uploaded at 
https://gitlab.freedesktop.org/poppler/poppler/-/issues/1075

I think the generation number wasn't changed because I was using 
xref->setModifiedObject.  I'm not sure what the actual correct thing to 
do is, even though it works with the PDF viewers I'm using.

The code currently just exposes an insertOutline function that can be 
used to insert an outline in the following fashion.

  outline->insertOutline({ {"page 1", 1,
                             { { "1.1", 1, {} } }   },
                            {"page 2", 2, {} },
                            {"page 3", 3, {} },
                            {"page 4", 4,
                             { { "4.1", 4, {} },
                               { "4.2", 4, {} },
                             },  }

The code itself probably isn't all that great as I'm not really familiar 
with the codebase.

     thanks,
     rob


On 5/2/21 11:08 AM, Oliver Sander wrote:
 > Hi Rob,
 >
 >> 2. After writing a bit of code to add an outline and save the
 >> resulting PDF, the file had a trailer section which referred to the
 >> new Catalog dictionary as expected.  However, the new Catalog
 >> dictionary had the same object and generation numbers as the old one.
 >> So there were now two 'obj 1 0' in the file; is this expected
 >> behavior?
 >
 > I don't think it is.  And from my understanding of the spec the 
generation
 > number is practically always 0, so incrementing it may not be the
 > correct solution.
 >
 > It will be easier to help you if we can see your code.
 > Maybe you can share your current patch at
 >
 >    https://gitlab.freedesktop.org/poppler/poppler
 >
 > Best,
 > Oliver
 >
_______________________________________________
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic