Skip to content

PDF bookmarks not listed #760

@animalan

Description

@animalan

System information

OS: Windows 11 Version 10.0.22621 Build 22621

pdfcpu: v0.6.0 dev
commit: e33b502b (2023-12-13T10:22:47Z)
base  : go1.20.6

Problem
I tried listing the bookmarks from this PDF on arXiv using the CLI command pdfcpu bookmark list but got the following:

> pdfcpu bookmark list in.pdf
optimizing...













I expected this:

> pdfcpu bookmark list in.pdf
optimizing...
1 Introduction
2 Methodology
    2.1 Physical Picture
    2.2 Direct Collisions
    2.3 Statistical Approach to Collisions
    2.4 Mass Growth
    2.5 Uncertainties in Accretion
    2.6 GW Inspiral
    2.7 IMBH growth
    2.8 Gravitational Wave Mergers and Intermediate and Extreme Mass Ratio Inspiral Candidates
    2.9 Two Body Relaxation Processes
    2.10 Effect of Relaxation Processes
3 Discussion and Predictions

Based on the number of newlines from the output, pdfcpu does seem to recognize that the bookmarks are there but it doesn't print their titles. I investigated this a little further with the API:

package main

import (
	"fmt"
	"os"
	"github.com/pdfcpu/pdfcpu/pkg/api"
)

func main() {

	file, _ := os.Open("in.pdf")
	titles, _  := api.Bookmarks(file, nil)

	fmt.Println(titles)
}

and got this (titles are missing):

[{ 1 1 false false <nil> [] <nil>} { 2 6 false false <nil> [{ 2 2 false false <nil> [] 0xc0000840f0} { 3 3 false false <nil> [] 0xc0000840f0} { 4 4 false false <nil> [] 0xc0000840f0} { 4 4 false false <nil> [] 0xc0000840f0} { 5 5 false false <nil> [] 0xc0000840f0} { 5 5 false false <nil> [] 0xc0000840f0} { 6 6 false false <nil> [] 0xc0000840f0} { 6 6 false false <nil> [] 0xc0000840f0} { 6 6 false false <nil> [] 0xc0000840f0} { 7 0 false false <nil> [] 0xc0000840f0}] <nil>} { 7 0 false false <nil> [] <nil>}]

I'm not sure if this problem is due to the PDF or pdfcpu. Any insight into this would be great. Thanks for the wonderful library!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions