fwenzel / stapler

A small utility making use of the pypdf library to provide a (somewhat) lighter alternative to pdftk
Other
23 stars 1 forks source link

feature request: rotate #2

Closed jwhendy closed 13 years ago

jwhendy commented 13 years ago

Is it possible to rotate with stapler? It seems that this evolved from pydftk, which has the ability to rotate, kind of (I think you can rotate one page and have it be extracted, but not pick out, say, page 2 out of 10 and have 1 and 3-10 be regular and 2 be rotated all in the same doc).

Just wondering if this will have rotating abilities like pdftk. I'm sold out on it (especially since pdftk is not wanting compile), but wish it could rotate!

Thanks for your work on this!

fwenzel commented 13 years ago

Yes, it actually supports rotating!

There is a little mention of it in the command help: R, L, or D will rotate the respective range +90, -90, or 180 degrees, respectively. (e.g., 1-15R)

So if you do stapler sel test.pdf 1-3R 4-end output.pdf then your file output.pdf will contain the first three pages rotated to the right, and pages 4 until the end with no changes.

Hope this helps!

jwhendy commented 13 years ago

How do you print the whole help? I've tried: ,-----
| $ stapler help (or -help or --help)
| too few arguments
| Usage: stapler mode arguments [output]
| arguments:
| cat: input pdf files (output is needed for this mode)
| split: input pdf files (no output needed)
| sel: | ... (output needed)
| del: | ... (output needed)
`-----

Either way... this is awesome! I think this officially now does everything I would have wanted from pdftk, which isn't compiling for me anymore recently... Would you be able to update your readme with the proper help command or where one finds a complete usage guide?

Thanks! John

fwenzel commented 13 years ago

Just enter stapler, it'll show you all it knows.

fwenzel commented 13 years ago

and yes, I can update the README, sure :)

jwhendy commented 13 years ago

Hmmm. Not for me. I just get this:
,---
| $ stapler
| too few arguments
| Usage: stapler mode arguments [output]
| arguments:
| cat: input pdf files (output is needed for this mode)
| split: input pdf files (no output needed)
| sel: | ... (output needed)
| del: | ... (output needed)
`---

Shoot. Just realized the Arch post points to this... but the package on AUR is still Heller Barde's. That's the issue -- I've been using the "wrong" stapler! How might I tweak the current pkgbuild for yours? I just tried and upon usage it complained about not finding the staplelib module. Where would it make sense to install that?

Well, this was probably the issue I was having. Your version has rotating and the other does not, or at least doesn't mention it.

fwenzel commented 13 years ago

Staplelib is part of "my" stapler's source code. What's the "Arch post" you're referring to?

jwhendy commented 13 years ago

I know that. See the post by Heller Barde here: https://bbs.archlinux.org/viewtopic.php?pid=771512#p771512

When he made it, I took that to mean that the AUR package (here: http://aur.archlinux.org/packages.php?ID=29126) was now using your update since he clearly said the "latest and greatest," but then looking at the PKGBUILD, I noticed that it still points to his git repo.

So... if his does not feature rotating abilities and yours does, I'd love to figure out how to create a new PKGBUILD which successfully installs your version. Most things are the same, but I'm not sure where to try and install the staplelib directory.

Cloning your repo and running from the directory works fine; there must be some way to replicate this via a package that can be tracked with pacman?

Hopefully that explains things better.

jwhendy commented 13 years ago

Still curious about this. I'd love to feature your version of stapler in the AUR as well. It seems that Heller even thought of yours as an improvement... so I'm not sure why the AUR still uses yours. I'm not familiar with how Python applications install and could modify the PKGBUILD myself except that I don't know where staplelib should live once installed.

Thanks for any input.

fwenzel commented 13 years ago

If you tell me what I need to change about my app, I am willing to do that, though unfortunately I know nothing about archlinux or its package management system, so can't really help with that. I think python packages usually have a setup.py file. I could add that to it, at the very least, allowing it to be installed with easy_install or pip.

jwhendy commented 13 years ago

I'm not all that sure, myself! I did look into this though, and found the Arch python packaging standards here: https://wiki.archlinux.org/index.php/Python_Package_Guidelines

The pkgbuild is pretty simple. You'd just have to make a setup.py file that put things in the right place. If you created a setup.py file, I'd be happy to make a pkgbuild and test? It might be helpful to know what's required for stapler to run properly, but I could probably steal that info from the pkgbuild for Heller's version?

jwhendy commented 13 years ago

Sorry to pester about this again... any ideas about using this with easy_install? I'd love to make this available to others since it has so many additional features over the other version. Any thoughts? Thanks!