Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is a little off-topic but you seem like a good person to ask:

Do you know a way to crop a PDF? Basically, if I have a PDF of a single letter-size page with a 6x9 label on it, and I'd like to crop it down to that 6x9 label only, is there a way to do this? I've been looking into this with, for instance, the poppler library, and haven't found anything.



i suppose you mean you want to do that with code, and not using a tool ( because my first search would be for command line tool or automation software using a combination of pdf to jpg then crop then export in pdf).

You could parse the pdf for that bit of text then simply recreate a new one with the correct size. But it depends a lot of how that label is printed ( using one block for the whole label or one per letter). Basically it's a lot of work or not depending on the number of cases you need to deal with.

I know python has a python miner library, you may want to try that


Yep, I'm looking for a way to do that with automation somehow, either code or even a command-line tool, just not manually with a GUI.

My issue with JPG conversion is the lossiness factor introduced there; I'm trying to avoid that.

There should only be one case: a single label on a letter-size page surrounded by a lot of whitespace. I'll check out that miner library; thanks!!




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: