[poppler] API for outline/table of contents modification
rm+popplerlist at arcsin.org
rm+popplerlist at arcsin.org
Mon May 3 05:04:30 UTC 2021
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
>
More information about the poppler
mailing list