As developers, we love our CLI tools. When we need to merge, compress, or convert a PDF, our first instinct is usually to open the terminal, fire up Ghostscript, or write a quick Python script.
But let's be honest: sometimes you just need to resize an ID card to exactly under 100KB for a government portal, and writing a binary search loop to guess the right compression ratio isn't worth the 20 minutes it takes.
Historically, when I didn't want to script it, I'd use iLovePDF. But between the file limits, ads, and privacy concerns of uploading sensitive documents to a third-party server, I started looking for alternatives. Eventually, I met an online tool with alike features (but free): pdfBae.
Here is a look at how to handle the most common PDF tasks the "developer way," and how you can save time by doing it the "GUI way."
1. Converting JPG to PDF (Under a Specific Size limit)
The Dev Way (Python & img2pdf)
If you just need to wrap an image into a PDF container without losing quality, img2pdf is the standard approach.
import img2pdf
import os
image_path = "document.jpg"
pdf_path = "output.pdf"
# Simple conversion
with open(pdf_path, "wb") as f:
f.write(img2pdf.convert(image_path))
The Catch: This doesn't compress the image. If the portal you are uploading to has a strict 100KB limit, you have to run it through ImageMagick first, check the size, tweak the quality flag, and try again.
The Time-Saving Alternative
Instead of guessing JPEG quality settings in the terminal, I built a specific tool for this. You just drag and drop your image, and it dynamically adjusts the compression to hit your exact target size.
👉 Try it: JPG to PDF 100KB
2. Compressing an Existing PDF
The Dev Way (Ghostscript)
Ghostscript is the undisputed king of PDF manipulation in the terminal. To compress a bloated PDF, you can run:
gs -sDEVICE=pdfwrite \
-dCompatibilityLevel=1.4 \
-dPDFSETTINGS=/screen \
-dNOPAUSE -dQUIET -dBATCH \
-sOutputFile=compressed_output.pdf \
input.pdf
The Catch: The -dPDFSETTINGS=/screen flag reduces the resolution to 72dpi. But what if the output is 120KB and you explicitly need it under 100KB? Ghostscript doesn't have a "target file size" flag. You're left manually stripping metadata or downsampling images via complex ghostscript parameters.
The Time-Saving Alternative
I got tired of tweaking Ghostscript flags for form uploads. On PDFBae, the compression engine handles the math for you. Because it utilizes modern browser APIs and Web Workers, it processes the files quickly and safely.
👉 Try it: Compress PDF to 100KB
3. Reordering, Splitting, and Organizing Pages
The Dev Way (Python & PyMuPDF)
If you have a 10-page PDF and you only want pages 1, 3, and 2 (in that order), PyMuPDF (fitz) makes it pretty straightforward:
import fitz # PyMuPDF
doc = fitz.open("messy_document.pdf")
# Create a new blank PDF
new_doc = fitz.open()
# Insert pages 1, 3, and 2 (0-indexed)
new_doc.insert_pdf(doc, from_page=0, to_page=0)
new_doc.insert_pdf(doc, from_page=2, to_page=2)
new_doc.insert_pdf(doc, from_page=1, to_page=1)
new_doc.save("organized_document.pdf")
The Catch: Writing a script for this is fine if you're automating a batch job for 1,000 files. But if you're just trying to remove a blank page from a contract before emailing it, writing a 10-line script is overkill.
The Time-Saving Alternative

For visual tasks, you need a visual tool. The organization tool lets you visually drag, drop, rotate, and delete pages directly in your browser.
👉 Try it: Organize PDF
Wrapping Up
Writing scripts to manipulate PDFs is a great exercise, and CLI tools like Ghostscript are incredibly powerful for server-side automation. But for one-off tasks—especially when strict file size limits are involved—having a fast, reliable GUI is a lifesaver.
I shared PDFBae.com to be the developer-friendly alternative to the bloated PDF sites out there. It’s fast, free, and gets out of your way.
Bookmark it for the next time you need to hit that dreaded "File must be under 100KB" upload requirement!
Let me know your suggestions and updates if missing.
Top comments (0)