pdfly
pdfly copied to clipboard
1-based ranges support
Please explain your intent
Provide a better UX for pdfly cat.
Describe the solution you'd like Use 1-based ranges, not 0-based. Modern pdf viewer number pages from 1.
Additional context
Even pdfly cat --help shows that something is indeed wrong with the current approach:
Page range expression examples:
...
22 just the 23rd page. :-1 all but the last page
...
5: from the sixth page onward. -3:-1 third & second to last.
Thinking of an even better approach one might consider: comma support, dash support and inclusive ranges.
So to cat pages 1 and 6 to 11 from a file one should type just that: pdfly cat -o out.pdf in.pdf 1,6-11. This is the range description used by PdfSam (the software I currently use to work with pdf files).
Hi @georgthegreat
Thank you for reaching out with some interesting suggestions 👍
Use 1-based ranges, not 0-based.
This would be a backward-incomptible change, and I fear that it would bring quite some annoyance to our end-users when they upgrade pdfly...
Yet it's true that all PDF viewers I know index pages starting at 1, so making pdfly pages indices starting at 1 would probably be a usability improvement.
In fact, I just realized that I suggested the same idea in issue https://github.com/py-pdf/pdfly/issues/23 two years ago 🙂
I'd be curious to know what do you think about this @MartinThoma, as you originally implemented the pages ranges? 🙂
Thinking of an even better approach one might consider: comma support, dash support and inclusive ranges.
I think we could support bot the "Python ranges" syntax, and the more common "comma & dashes" syntaxes.
That could probably make pdfly cat usage more intuitive.
Regarding those 2 suggestions, we should take care to make this page-indexing changes for ALL pdfly SUBCOMMANDS, of course.
@georgthegreat: would you like to contribute yourself some of those enhancements to pdfly?
This project is 100% volunteer-based, so the best way to introduce such new usability features is to implement them 🙂
@allcontributors please add @georgthegreat for ideas
Maybe we should follow du cli interface and do something like pdfly cat --human-readable 1,5-8 .
As I am looking for pdfsam replacement, I will take a look on implementing this later on.
As I am looking for pdfsam replacement, I will take a look on implementing this later on.
Thank you for volunteering! 👍
Maybe we should follow
ducli interface and do something likepdfly cat --human-readable 1,5-8.
It's a good idea to take inspiration from existing standard tools 🙂
However du --human-readable is about making the output human-readable, it does not affect how it interprets CLI args.
Let option naming to be the hardest thing to discuss inside the PR.