3 ms·
I’m building something on ios to extract text only from pdf along with some basic rendering features ( text position and font info, something that big commercia
by bsaul 8y ago
I’m building something on ios to extract text only from pdf along with some basic rendering features ( text position and font info, something that big commercial libraries don’t provide curiously ). So i’m using apple core foundation lib to do the basic parsing and use a project called pdfkitten as a starting point for font to unicode decoding and text positionning. I also plan to add obvious heuristics for « words » building later on as well as a global index for all the rendered blocks ( all done in swift). Images, forms, etc, are completely out of the scope.
It’s a very specific and ( hopefully) narrow need and is the only reason i’m starting this project in the first place.
- magduf 8y agoThis 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.
- bsaul 8y agoi 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
- magduf 8y agoYep, 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!!
- jacquesm 8y agoThank you, I missed your answer when it first was given.