DEV Community

Cover image for How To Combine PDF Files on a Mac: A Simple Guide for Busy Developers
Nitin Hepat
Nitin Hepat

Posted on

How To Combine PDF Files on a Mac: A Simple Guide for Busy Developers

How To Combine PDF Files on a Mac: A Simple Guide for Busy Developers

Ever found yourself juggling multiple PDF files? Whether it's project documentation, client contracts, or technical manuals, managing several PDFs can quickly become overwhelming. The solution? Combine them into one single file. It's easier to manage, share, and looks way more professional.

In this guide, I’m going to show you how to combine PDF files on a Mac using two different methods: PDFBoosters.ai, a quick and secure online tool, and Preview, a built-in Mac app that’s surprisingly powerful. Let’s dive in.


Why Should You Combine PDF Files?

You’ve probably already felt the pain of managing several PDF files for a single project or client. Combining them can save you time, make your files more organized, and create a professional presentation. Here’s why merging PDFs is a no-brainer:

  • Better organization: All relevant documents in one file—no more hunting through folders to find the right one.
  • Easy sharing: Send just one file instead of a bunch of attachments.
  • Polished appearance: It looks way more professional to have everything neatly packaged in a single PDF.

Now that you know why it’s worth doing, let's explore two ways to merge PDFs on your Mac.


Method 1: How to Combine PDF Files on a Mac Using PDFBoosters.ai

If you’re like me, you appreciate a no-fuss, quick solution. That’s where PDFBoosters.ai comes in. It’s an online tool that lets you merge PDF files effortlessly—without the need for installing any software.

Step-by-Step Guide:

1. Go to PDFBoosters.ai’s Merge Tool

First, head over to PDFBoosters.ai and select the Merge PDF tool from the homepage. No need to mess around with downloads or complicated setups—everything runs in your browser.

2. Upload Your PDFs

Once you're on the Merge PDF page, you can upload your files by either dragging them into the tool or clicking the Choose Files button. You can select multiple PDFs at once, or add them one by one if needed.

3. Add More PDFs

Forgot to upload a file? No worries! PDFBoosters allows you to add more files even after you’ve already started. Just hit the Add Files button and upload the additional documents.

4. Rearrange the Pages

Now that all your files are uploaded, you can reorder them by simply dragging and dropping. This is useful when you want the pages to be arranged in a specific order.

5. Click “Save & Download”

Once you’ve got everything in the right order, click Finish. PDFBoosters.ai will merge your PDFs together in a matter of seconds—even for larger files.

6. Download Your Combined PDF

After the process is complete, you’ll be able to download the newly merged PDF file. It’s as simple as that!


Why Use PDFBoosters.ai?

  • No installations: You don’t have to install anything, making it perfect for quick merges on the go.
  • Fast and secure: Your files are processed quickly and securely, without long-term storage.
  • Easy to use: With its simple drag-and-drop interface, merging PDFs has never been easier.

Whether you’re at home, in a café, or on a client’s site, PDFBoosters.ai makes merging PDFs a breeze, especially when you need things done fast.


Method 2: How to Combine PDFs Using Preview on Your Mac

If you prefer not to use online tools, or maybe you just want to use what’s already available on your Mac, Preview is another fantastic option. It’s a built-in app that can do way more than just view PDFs.

Here’s how you can merge PDFs using Preview:

1. Open the PDFs in Preview

Start by opening the first PDF you want to combine. Just right-click on the PDF file, select Open With, and choose Preview. Then, do the same for the second PDF, opening it in a separate Preview window.

2. Enable Thumbnail View

To make things easier, go to the View menu and select Thumbnails. This will show a sidebar with all the pages of your PDF.

3. Drag and Drop Pages

Now, open the second PDF and do the same—enable the thumbnail view. From here, simply drag the pages from the second PDF’s thumbnail sidebar and drop them into the first PDF’s thumbnail sidebar. You can reorder the pages if needed.

4. Save the Combined PDF

Once you’ve got everything in the right order, go to File > Export as PDF and save your newly combined document. Voila! You’ve merged your PDFs right on your Mac without any extra software.


Bonus: Automating PDF Merging with JavaScript

For developers who want to automate the process or build it into their own apps, you can use JavaScript to merge PDFs programmatically. A popular library for this is pdf-lib, which makes it super easy to combine multiple PDFs with just a few lines of code.

Here’s a quick example:

import { PDFDocument } from 'pdf-lib';
import fs from 'fs';

async function mergePDFs(filePaths) {
    const mergedPdf = await PDFDocument.create();

    for (const filePath of filePaths) {
        const pdfBytes = fs.readFileSync(filePath);
        const pdf = await PDFDocument.load(pdfBytes);
        const copiedPages = await mergedPdf.copyPages(pdf, pdf.getPageIndices());
        copiedPages.forEach((page) => mergedPdf.addPage(page));
    }

    const pdfBytes = await mergedPdf.save();
    fs.writeFileSync('merged.pdf', pdfBytes);
}

mergePDFs(['file1.pdf', 'file2.pdf']);
Enter fullscreen mode Exit fullscreen mode

This post first published on PDFBoosters.ai

Top comments (0)