Converting PDF files with imagemagick reddit / selfhosted ---------------------------------------------------------------------- mikeee404 · 2023-09-26 21:01 So I am setting up a Joomla website and I want to automate some tasks. I have a bunch of PDF files that I need to convert to either image or text each week and then insert into an article on a schedule. Automating the tasks for uploading the PDF to the Debian container in Proxmox running the website, converting the PDF, and publishing the articles all on schedule is all sorted out. Where I am having an issue is the process of converting the PDF to text or image using `imagemagick` requires me to change read/write permissions in the `/etc/ImageMagick-6/policy.xml` file. I am curious if this will open up some security issues from the website side of things or if this only affects server side jobs like a script running in cli? If this does then I could always spin up another container just to handle that task and the scp the files over to the web host container after conversion, but I would really prefer not to complicate things anymore than I will be. If there is a better tool than `imagemagick` to do the conversion I am open to suggestions. ---------------------------------------------------------------------- NikStalwart · 2023-09-26 23:51 > I could always spin up another container just to handle that task and the scp the files over to the web host container after conversion, This is the correct way. The general idea is that "one container = one application". > f there is a better tool than imagemagick to do the conversion I am open to suggestions. Not for PDFs. In fact, you're going to have a miserable time with pdf- to-text conversion as it is, but images should work fine. The thing is, PDF is just an absolutely awful format that should be eradicated as a crime against humanity. Source: I work with them *a lot*. ---------------------------------------------------------------------- mikeee404 · 2023-09-26 23:56 >Not for PDFs. In fact, you're going to have a miserable time with pdf-to-text conversion as it is, but images should work fine. >The thing is, PDF is just an absolutely awful format that should be eradicated as a crime against humanity. Yeah I ran a few tests and what a shit show it was converting to text, nothing was consistent one PDF to the next. Converting to JPG went smooth so I think that will be the way to go since it even simplifies my article integration. ---------------------------------------------------------------------- Canadaian1546 · 2023-09-26 23:58 Isn't the biggest issue with PDF being everyone(each company) has their own way of handling the compression algorithm? ---------------------------------------------------------------------- NikStalwart · 2023-09-27 00:13 The issue with PDF is that it exists. And, because it exists, people use it. If it didn't exist, people wouldn't be tempted to use it. Let me use an example from uni to illustrate this: so, normally, lecturers are expected to create their own slide decks (that's what they are being paid for — to teach). However, more than a few are lazy bastards who can't be stuffed writing their own slides so they reuse the slide decks prepared by the textbook publishers. The slide decks are distributed to lecturers in PowerPoint format so that the lecturers can make last-mile corrections. Before these slides can be given to students, the lecturers must "take steps" so that students don't "steal" the publishers oh-so-precious intellectual property. The way most lecturers do this is by exporting their PowerPoint slides to PDF before they make them accessible to students. What this fundamentally means is that I cannot read the damn things with text- to-speech software because PDF is an awful format, but it does absolutely nothing to prevent distribution because you can redistribute a .pdf just as easily as you can a .pptx. Another example: we have a style guide, called the Australian Guide to Legal Citation, distributed by the University of Melbourne. The AGLC is, of course, distributed only in PDF format. The wankers in charge of that publication think that it is very important to prevent edits, so they even encrypted the document. Nobody told them that qpdf can strip their encryption in 20 seconds  — including the time it takes me to read the manual because I only use it 3 times a year. The question is: why do people still use PDF if it is so crap? Because of technical policies instituted by non-technical people. ---------------------------------------------------------------------- tweek011 · 2023-09-27 08:22 Might want to check out the following project Stirling-PDF. It’s simple to spin up and has a ton of useful tools/options centered around PDF’s. I absolutely love it and consider it an amongst my must have list. Here’s a direct link to the GitHub for you check out. https://github.com/Frooodle/Stirling-PDF ---------------------------------------------------------------------- mikeee404 · 2023-09-27 11:20 Thanks I'll check it out. Not crazy about it being a docker only application but it's still worth a look.