Remix.run Logo
Imustaskforhelp 4 days ago

A way to merge multiple pdfs together/some features of sterlingpdf

Yes I know I could self host it but I felt really overwhelmed self hosting it.

So much so that I created a golang (LLM generated, funny how I am so AI skeptic when I use it, hey I just don't think its worth it economically no matter what) but yeah, its a simple golang code which just takes some pdfs, merges them. The code is shitty but I didn't write it and stores it in the server for some time so you definitely need to make some modifications.

https://gist.github.com/SerJaimeLannister/d925689d54fe7ccf79...

Please modify it as I (built?) this for my own use case but the main thing I want to take away from this is that pdfcpu for golang might be really nice library for golang for pdf's except the binary is 20MB of size and I would love to see it shrunk down a bit y'know.

Anyways, nice project.

lorenzohess 4 days ago | parent [-]

The pdftk program makes it super easy to merge PDFs if CLI meets your use case.

Imustaskforhelp 4 days ago | parent [-]

I had a lot of pdfs and so a single drag and drop of web would've made more sense and in fact initially I thought of some golang tool that is just a simple http wrapper over the cli too.

lelanthran 4 days ago | parent [-]

> I had a lot of pdfs and so a single drag and drop of web would've made more sense and in fact initially I thought of some golang tool that is just a simple http wrapper over the cli too.

Depending in your file manager, drag and drop might work on shell scripts too. Even multiple files.

TBH, when I last needed something like that I simply called zenity from my shell script.

Imustaskforhelp 4 days ago | parent [-]

Hm I didn't know drag and drop could work on shell scripts too!

That's something new!!

OHHH that's actually really cool to have zenity, Wow. I didn't know about this...

Is this thing cross platform? I like it if you are saying that it would open up a drag and drop box and then merge the pdf's

Definitely a bit harder than what I had cooked but I respect it, I might use zenity or some gui-esque option to convert cli's into gui of sorts y'know..

But my tool is just some lines of golang which can be go mod init go mod tidy go run . and it would open up localhost port and can even be accessed through other devices on the same network but your thing is really cool too

Can you though please share me the shell scripts or something so that I don't have to write the shell scripts when I need in the time of need y'know?

Like your approach is nice too and something to know in the back of my mind too

lelanthran 4 days ago | parent [-]

> Hm I didn't know drag and drop could work on shell scripts too!

Depends on the file manager. I use Caja which is fairly ancient, and supports this, so I expect newer file managers to support it too.

For PDFs, something like this might work (note: not tested)

     #!/bin/bash

     pdftk $@ cat output output.pdf verbose &> /tmp/output

> that's actually really cool to have zenity, Wow. I didn't know about this...

> Is this thing cross platform? I like it if you are saying that it would open up a drag and drop box and then merge the pdf's

Not sure if zenity is x-platform; what I did do once when I needed to select multiple files was have the shell script sit in a loop calling zenity, appending filenames to a variable, and then display a confirmation with a "Process" button before performing the actual processing.

ISTR using zenity for display the file selection dialogs, the confirmation dialog and a progress indicator while processing.

> But my tool is just some lines of golang which can be go mod init go mod tidy go run . and it would open up localhost port and can even be accessed through other devices on the same network but your thing is really cool too

Yeah, I just needed something temporarily for the operators to use during a build process. Wasn't going to need network access, nor did I want to add in a new dependency by using Python or something.