py-pdf / py-pdf/pdfly

x2pdf command adds images to pdf in the wrong order

Open Beginner friendly
#241 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
571
Forks
50
PR merge metrics
No merged PRs in 30d

Description

I ran this command:
uvx pdfly x2pdf *.jpeg -o output.pdf

The pdfly x2pdf command will convert a folder of images (organized like 0001.jpeg, 0002.jpeg, 0003.jpeg, etc.) into a pdf that is backwards where the 3rd jpeg is the 1st page in the pdf.

I think it's because this line will add the new_page at index 0 for every filepath and it ends up prepending instead of appending:
https://github.com/py-pdf/pdfly/blob/06f79b3f038715f99e306382e12306607db0e8ad/pdfly/x2pdf.py#L42

Environment

  • Operating System: Fedora Linux 43
  • Python version: 3.13.11
  • pdfly version used: 0.5.1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pdfly/x2pdf.py at the linked line and reproduce uvx pdfly x2pdf *.jpeg -o output.pdf using sequentially named images. Check the generated PDF page order against the input order; done means the first image is the first page and later images follow sequentially.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.