Stirling-PDF: local web application to perform various operations on PDFs
github.com
github.com
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.
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.
Try xournal++
Though I welcome (new) work in this area.
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.
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
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.
Point is - paradigms shift, unacceptable prices become affordable. Generational gaps manifest themselves not just between parents and children.
[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
https://pdfa.org/resource/pdf-in-manufacturing/ is a great usecase.
I recently had to add an embed feature to our pdf rendering, to allow users to embed other pdfs inside the one we generate for them. Since we use headless Chrome, I used pdfjs from mozilla to render the embedded pdf on screen before generating the pdf, so you can actually see and read the embedded pdf.
Works pretty well, but was wondering about this attachment feature of pdfs.
Since these pdfs end up in whatever and how old devices, I'd rather not risk it though.
> 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?
There's a fairly big chunk in the spec of special presentation attributes for slideshows. When I implemented them I was surprised that slide shows produced by Acrobat didn't work. Well, obviously my implementation was buggy.
Er, no, Adobe didn't use their own slide show attributes for the slide shows produced by Acrobat. They used JavaScript instead.
Oh well. ¯\_(ツ)_/¯
Adobe Acrobat is the only thing that can handle all cases yes. All other programs uses (different) special cases each and most of them fail in some edge cases. It can be funny letters showing up because of fonts not working properly or images disapearing or all sorts of things. I have given up to fix them all. I still have a library of PDF's that we used to run through to try to get as many as possible to work.
That's because PDF is well designed and has a fallback for advanced page elements so more primitive readers can still render them.
Edit: Apparently some people can edit PDFs reliably with MacOS Preview.app, LibreOffice Draw or pdftk.
*To get reimburses from a union or something.
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.
It’s local only (the document you load and data you fill in never leave the browser) and free
Disclosure: I’m the developer behind it
For other colors, it’s in the backlog!
(I’d aiming to automatically provide the correct color by inspecting pixels within the area to redact, to make it as simple as possible)
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.
What shenanigans? On one computer, we have a 15 year old version of Foxit running as good as new, no further licensing needed.
I see that much more with Adobe than with anyone, fwiw.
https://www.foxit.com/pdf-editor/
The one-time license option is hidden away in a product comparison table (and linked to in a few other far less visible places).
Nitro, the other PDF editor you mentioned, appears to offer only a one-off purchase:
https://www.gonitro.com/pricing
But it says "for Windows" and at the top of the page, there's a promotion saying "Get up to 1 year subscription - free when you switch to Nitro". So there is a subscription after all?
If you keep scrolling down to the FAQ and there's a question asking:
"Is Nitro available as a subscription or a one-time purchase?
Nitro Pro, ideal for individuals and small to medium sized teams, is available as an annual subscription."
No mention of a one-time purchase option. So which is it? I'm confused. Is this "one-time purchase" a perpetual license or does it stop working after a year?
These are certainly not the most egregious examples of pricing shenanigans. But given the recent history of companies going subscription-only, this is enough uncertainty for me not to buy.
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.
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.
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 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. .
Yes, the United States Library of Congress makes heavy use. I imagine their evaluation process to select a digital archive format is very tough!
- OpenXPS (https://en.wikipedia.org/wiki/Open_XML_Paper_Specification)
- EPS (https://en.wikipedia.org/wiki/Encapsulated_PostScript).
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.
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'm not at my computer, but try messing with the `/printer` in the above command, there are other options, (possibly `/ebook`?) that control the compression ratio from memory.
Haven't updated it in while though... :-/
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.
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.
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
I am not desiring something perfect - I can fix if ther are some errors, but so far nothing has come with a good result.
I started making app to read our board game cards out loud (with voice) for our horror board game nights (https://boardguru.net) and GPT-4 could read cards that I couldn't make out!
You can do that very easily with a locally installed ImageMagick. ChatGPT can help with the commands needed, but should be just one to convert a PDF to a number of JPGs and a small shell script to run on all your files.
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.
You just need to extract each of the elements into a structured JSON or something, right?
I'll try with your example later today.
Let me know how GPT-4V does!
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...