Krasjet / Krasjet/pdf.tocgen

pdftocio throws error when saving

Open
#27 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
848
Forks
31
PR merge metrics
No merged PRs in 30d

Description

Hi, I'm trying to use `pdftocio` to generate a ToC for a pdf. I have already generated the toc file using `pdfxmeta` and 'pdftocgen`. The error is as following:
```
Traceback (most recent call last):
File "/home/amzon-ex/.local/bin/pdftocio", line 8, in
sys.exit(main())
^^^^^^
File "/home/amzon-ex/.local/lib/python3.11/site-packages/pdftocio/app.py", line 163, in main
doc.save(out)
File "/home/amzon-ex/.local/lib/python3.11/site-packages/fitz/fitz.py", line 4710, in save
return _fitz.Document_save(self, filename, garbage, clean, deflate, deflate_images, deflate_fonts, incremental, ascii, expand, linear, no_new_id, appearance, pretty, encryption, permissions, owner_pw, user_pw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: cannot find object in xref (2818 0 R)
```

Can you help?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in pdftocio/app.py at the main function and the doc.save(out) call shown in the traceback. Reproduce the failure with the same pdftocio, pdfxmeta, and pdftocgen workflow, then determine which input PDF or save condition causes the missing xref object. Done means the reported PDF saves successfully or the failure is handled with a clear explanation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.