Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF bookmarks not listed #760

Closed
amrle opened this issue Dec 22, 2023 · 2 comments
Closed

PDF bookmarks not listed #760

amrle opened this issue Dec 22, 2023 · 2 comments
Assignees

Comments

@amrle
Copy link

amrle commented Dec 22, 2023

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!

@hhrutter
Copy link
Collaborator

hhrutter commented Jan 2, 2024

Thanks for reporting this!

@hhrutter
Copy link
Collaborator

Fixed with latest commit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants