507 points · by alexzeitler · 2y ago · 231 comments
Why would I run a docker container, a webserver, start a browser, navigate webpages... just to do some operations on a pdf locally?
A few KiloBytes native program like PDFtk (https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/) does the job perfectly.
I don't understand what is the point of bloating softwares like this. Not even speaking of the very bad consequences for the planet.
Um. I work with PDFs a LOT and.. nah PDFtk is pretty weak. It doesn't even do OCR!
This looks like a wonderful tool that solves a lot of problems that existing tools don't typically put together. It's an achievement, and your post is unnecessarily crass.
This is very much the sort of tool that you host internally at a newsroom so journalists don't have to wrangle with software or write code. Like, in that situation, who cares if it's on top of docker? The users definitely won't give a shit.
Please consider that you're not the target audience....
If because of your job you find yourself doing these operations very often, and the ability to do them from several devices with different OSes is valuable, it might be great to throw this on a server.
Or if your work has several people, may be not very technical folks, do them often. I’ve worked in a couple of places where this could’ve come in handy.
Also, it includes an API. Also, being open source, if in the future you’re creating a web app that needs some of these features, you could learn from/copy from its code.
I think this is a good contribution to the world.
> I don't understand what is the point of bloating softwares like this. Not even speaking of the very bad consequences for the planet.
I partially share this concern. I wouldn’t deploy this for myself unless I had a very easy way to stop it and start it, but anyway while not in use it it should only be consuming a bit of RAM, and there’s plenty of very efficient hardware suitable for small servers these days.
And PDFtk doesn’t do annotations afaik which is a huge pain point on Linux (at least for me) because there are no applications that I know of to easily do things that are trivial on OSX like adding text or hand drawn signatures to PDFs. Masterpdf can do it but with a watermark and some limitations.
Maybe it doesn’t suit your particular use case but I wouldn’t say pdftk can replace this project.
Though I welcome (new) work in this area.
Try xournal++
Point is - paradigms shift, unacceptable prices become affordable. Generational gaps manifest themselves not just between parents and children.
Is this binary statically linked? If not, I am sure the Tk libs are huge. Not as big as Chromium/Electron and friends, but large.
You just sent how much wattage around the globe 100 times for what? To print the paper you already had on your screen?
You sound like the kind of people who put their very important network documentation on Google Drive, so when your network goes down you have no way to access the information required to bring it back up. I'd rather have one engineer who knows the ins-and-outs of a LAMP stack than 10 who only know how to provision cloud VMs.
> A few KiloBytes native program like PDFtk
[0] https://www.pdf.to [1] https://news.ycombinator.com/item?id=23238862 [2] https://github.com/ocrmypdf/OCRmyPDF [3] https://github.com/Frooodle/Stirling-PDF#technologies-used
There's a reason why, unlike raster image formats, there aren't any serious competitors. The thing to realise about printed page file formats is that even if you set aside all of the silly "multimedia" and "interactivity" features, there's still a gargantuan rabbit hole of non-trivial features that need to be implemented absolutely perfectly, from kerning to spot color. PDF does it all very well. There's really no scope for a competitor to come along to make something that's obviously better.
Yes, the United States Library of Congress makes heavy use. I imagine their evaluation process to select a digital archive format is very tough!
Yes. The first sentence of the Wikipedia article about PDF is:
>Portable Document Format (PDF), standardized as ISO 32000, is a file format developed by Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, hardware, and operating systems.
And the last sentence of the first paragraph of the same article is:
>PDF was standardized as ISO 32000 in 2008.[5] The last edition as ISO 32000-2:2020 was published in December 2020. .
> Adobe acrobat (and maybe reader) is really the only app that fully supports the full PDF spec
The full spec is large and afaik has many obscure pieces, including 3-D, etc. Like many specs, they don't match reality and nobody takes completeness too seriously. For almost all users, supporting the entire PDF spec doesn't matter (does it matter for any user - does any person or organization use the entire spec over their lifetimes?).
Also, do we know that Adobe supports the entire spec?
https://pdfa.org/resource/pdf-in-manufacturing/ is a great usecase.
Edit: Apparently some people can edit PDFs reliably with MacOS Preview.app, LibreOffice Draw or pdftk.
- OpenXPS (https://en.wikipedia.org/wiki/Open_XML_Paper_Specification)
- EPS (https://en.wikipedia.org/wiki/Encapsulated_PostScript).
*To get reimburses from a union or something.
In regards to Preview, I still find it insane that it doesn't have an iOS/iPadOS equivalent. Bits of the functionality are scattered all over the place, usually in ways that don't feel as good as they do on the Mac. Sometimes I just want to open a PDF and leave it open, and not have to do it from Files which assumes I want to do something else with it than just looking.
But for a lightweight, bloat-free experience, SumatraPDF is the way to go.
Where is all this stuff coming from? Why would you say Preview is the best? Foxit? Nitro? Their are endless PDF applications much more powerful and capable, some designed for professionals.
I think many people find that Preview.app does everything they ever wanted to do with PDFs. It really is surprisingly capable. It's also fast and far less convoluted than most PDF tools I have seen.
And of course it comes free with every Mac, which often makes it "best" in terms of value for money.
It doesn't help that many PDF editors (including the two you mentioned) are full of the most ridiculous pricing shenanigans.
And OS X and its successors use Display PDF natively, which is why it is trivial to save almost anything that can be displayed into a PDF file. The PDF stack that Preview.app leverages is a foundation of the OS itself.
For page-level edits (rotating, reordering etc) pdftk in the cli (+ChatGPT to find the right incantations) works very well.
The problems with PDFs I encounter, however, are large scale 1000 page PDFs that compile PDFs from multiple sources that clearly have multiple different types of encodings, fonts, etc.
I'd love to have a pipeline that properly 'shrinks' everything. Not sure thats what this thing does, but it looks like they're moving towards configuring pipelines that could get there.
This tools is not open source, but it’s free. Files should remain on local pc. Developers claim that they make money only by advertisement on their website.
I wonder why it's not open source by now.
- SPAs (Single Page App)
- SSR (Server-side Rendered App) (+ optional PWA client takeover)
- PWAs (Progressive Web App)
- BEX (Browser Extension)
- Mobile Apps (Android, iOS, …) through Cordova or Capacitor Multi-platform Desktop Apps (using Electron)
Might be worth considering if you're going full client.
Haven't updated it in while though... :-/
ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf
From this gist https://gist.github.com/guifromrio/6390547#I want to forward an email to an inbox, have the email body converted into a PDF, and then email that attachment to someone all automatically. I’ve tried Make, Zapier, pdf.co, pdftool, and a few other tools but have had no success. Has anyone solved this problem reliably?
Using low/no code tools might be very hard/unlikely
Obviously it's only an option if your org has already sunk deep into Microsoft-of-things (MoT) universe.
Email me and I’ll give you access for free.
A filter labels a specific email.
A timed trigger runs a script.
Script fetches all emails with that filter.
Script runs in loop. Convers each message into a blob, blob gets converted to pdf. Pdf gets saved in google drive. Email gets label removed.
My code was based on this https://www.labnol.org/code/19117-save-gmail-as-pdf
Mail.app can "Export as PDF" from the File menu, but I noticed on 13.6 that it exports blank pages if the email is plain text only.
I had to choose to print the emails and then save as PDF from the print dialog.
I am not desiring something perfect - I can fix if ther are some errors, but so far nothing has come with a good result.
It overlays all the pages on top of each other, you the human draws rectangles around the stacked columns in the easy GUI, and then it processes them into pages.
It just looses bold etc.
It supports basic operations such as filling forms, inserting text, images, etc.
You can test it out with a sample PDF here - https://photown.github.io/private-pdf/?pdf=https://raw.githu...
Any better alternatives I should be considering?
Probably because its not so intuitive, I have to google how to use some of the advanced features of Preview.
It needs to be web based and work on desktop/mobile.
If you’re on already macOS, Preview already has you covered.
At work I really have only been able to do the work I need on random PDFs with Adobe Acrobat. It seems strange that this is the case as PDF is now an open standard.
However, I have yet to find an equivalent tool from any other PDF application. And that includes this one.
Have you considered making serverless/browser-only version?
And then there is 2.0, and all the extensions [1]
And multiply that with the number of implementations.
If the goal is to make something that "always" works, you probably need a big team to keep up with the moving field of various bugs and reimplementations
[1] https://www.loc.gov/preservation/digital/formats/fdd/fdd0000...
It's js only, nothing is sent to the server. It automatically makes the background of signatures transparent. The result is a raster pdf as if you printed, signed and scanned the document. I use it on desktop, not sure if it works well on phones.
There are two levels of difficulty: the starting file could be an image (pdf or png or jpg), which is the most difficult scenario. The slightly easier one is where it’s a text-based pdf so no OCR is needed.
I threw this as an image file at google form parser but it did poorly, I.e missed quite a few fields.
In theory it's exactly this...
One option is to extract text blocks along with their coordinates (unstructured.io gives this, probably based on another pkg because it’s basically a container for many pigs). Then do the same with a blank template, and you then have an algorithmic problem of matching the filled values spatially with the key locations from the template.
Let me know what you think!
More generally, the PDF format is too flexible to decide what is “broken” or really is as intended, in many cases. It’s l a bit like asking for a tool that repairs “broken” source code where it’s really just the business logic that is broken.
For the document files, I love PDF Studio: https://www.qoppa.com/pdfstudio/
[0] eg, windows install script https://github.com/oobabooga/text-generation-webui/blob/main...