Combine Word, Excel, and PowerPoint Files into One Archived PDF in .NET
October 24, 2026 · 5 min read · GroupDocs Team
A month-end report, a project handover, a loan application: they often arrive as a folder with a Word document, an Excel workbook, and a PowerPoint deck, and they need to leave as one PDF that will still open the same way in twenty years. Our plugins each do one job, so this tutorial chains three of them: converters turn every file into PDF, Merge PDF joins the results, and PDF to PDF/A makes the merged document an archive.
What You Need
- .NET 6.0 or later on Windows, macOS, or Linux
- The two packages:
dotnet add package GroupDocs.Conversion.LowCodedotnet add package GroupDocs.Merger.LowCode- A
documentsfolder with the files to combine. The program takes them in file name order, so number them:01-report.docx,02-budget.xlsx,03-slides.pptx.
The Complete Program
using System;using System.Collections.Generic;using System.IO;using System.Linq;using GroupDocs.Conversion.LowCode;using GroupDocs.Conversion.Options.Convert;using GroupDocs.Merger.Domain.Options;using GroupDocs.Merger.LowCode;// Each package has its own License class: use the full namesGroupDocs.Conversion.LowCode.License.Set("GroupDocs.Conversion.LowCode.lic");GroupDocs.Merger.LowCode.License.Set("GroupDocs.Merger.LowCode.lic");var parts = Path.Combine("output", "parts");Directory.CreateDirectory(parts);// 1. Convert each document to PDF, in file name ordervar pdfs = new List<string>();foreach (var document in Directory.GetFiles("documents").OrderBy(name => name, StringComparer.OrdinalIgnoreCase)){ var pdf = Path.Combine(parts, Path.GetFileName(document) + ".pdf"); switch (Path.GetExtension(document).ToLowerInvariant()) { case ".docx": new DocxToPdfConverter(document).Convert(pdf); break; case ".xlsx": new XlsxToPdfConverter(document).Convert(pdf); break; case ".pptx": new PptxToPdfConverter(document).Convert(pdf); break; case ".pdf": File.Copy(document, pdf, true); break; default: continue; } pdfs.Add(pdf);}// 2. Merge the PDFs: the first one is the source, the others are appended in ordervar merged = Path.Combine("output", "merged.pdf");new JoinPdf(pdfs[0], pdfs.Skip(1), new JoinOptions()).Save(merged);// 3. Convert the merged PDF to PDF/A-2b for long-term storagenew PdfToPdfAConverter(merged).Convert(Path.Combine("output", "report-pack.pdf"), options => options.PdfOptions.PdfFormat = PdfFormats.PdfA_2B);open Systemopen System.IOopen GroupDocs.Conversion.LowCodeopen GroupDocs.Conversion.Options.Convertopen GroupDocs.Merger.Domain.Optionsopen GroupDocs.Merger.LowCode// Each package has its own License class: use the full namesGroupDocs.Conversion.LowCode.License.Set("GroupDocs.Conversion.LowCode.lic")GroupDocs.Merger.LowCode.License.Set("GroupDocs.Merger.LowCode.lic")let parts = Path.Combine("output", "parts")Directory.CreateDirectory(parts) |> ignore// 1. Convert each document to PDF, in file name orderlet pdfs = Directory.GetFiles("documents") |> Array.sortWith (fun a b -> String.Compare(a, b, StringComparison.OrdinalIgnoreCase)) |> Array.choose (fun document -> let pdf = Path.Combine(parts, Path.GetFileName(document) + ".pdf") match Path.GetExtension(document).ToLowerInvariant() with | ".docx" -> (new DocxToPdfConverter(document)).Convert(pdf); Some pdf | ".xlsx" -> (new XlsxToPdfConverter(document)).Convert(pdf); Some pdf | ".pptx" -> (new PptxToPdfConverter(document)).Convert(pdf); Some pdf | ".pdf" -> File.Copy(document, pdf, true); Some pdf | _ -> None)// 2. Merge the PDFs: the first one is the source, the others are appended in orderlet merged = Path.Combine("output", "merged.pdf")JoinPdf(pdfs.[0], Array.skip 1 pdfs, JoinOptions()).Save(merged)// 3. Convert the merged PDF to PDF/A-2b for long-term storage(new PdfToPdfAConverter(merged)).Convert(Path.Combine("output", "report-pack.pdf"), fun options -> options.PdfOptions.PdfFormat <- PdfFormats.PdfA_2B)Imports SystemImports System.Collections.GenericImports System.IOImports System.LinqImports GroupDocs.Conversion.LowCodeImports GroupDocs.Conversion.Options.ConvertImports GroupDocs.Merger.Domain.OptionsImports GroupDocs.Merger.LowCode' Each package has its own License class: use the full namesGroupDocs.Conversion.LowCode.License.Set("GroupDocs.Conversion.LowCode.lic")GroupDocs.Merger.LowCode.License.Set("GroupDocs.Merger.LowCode.lic")Dim parts = Path.Combine("output", "parts")Directory.CreateDirectory(parts)' 1. Convert each document to PDF, in file name orderDim pdfs As New List(Of String)For Each document In Directory.GetFiles("documents").OrderBy(Function(name) name, StringComparer.OrdinalIgnoreCase) Dim pdf = Path.Combine(parts, Path.GetFileName(document) & ".pdf") Select Case Path.GetExtension(document).ToLowerInvariant() Case ".docx" Dim wordConverter As New DocxToPdfConverter(document) wordConverter.Convert(pdf) Case ".xlsx" Dim excelConverter As New XlsxToPdfConverter(document) excelConverter.Convert(pdf) Case ".pptx" Dim powerPointConverter As New PptxToPdfConverter(document) powerPointConverter.Convert(pdf) Case ".pdf" File.Copy(document, pdf, True) Case Else Continue For End Select pdfs.Add(pdf)Next' 2. Merge the PDFs: the first one is the source, the others are appended in orderDim merged = Path.Combine("output", "merged.pdf")Dim merger As New JoinPdf(pdfs(0), pdfs.Skip(1), New JoinOptions())merger.Save(merged)' 3. Convert the merged PDF to PDF/A-2b for long-term storageDim archiver As New PdfToPdfAConverter(merged)archiver.Convert(Path.Combine("output", "report-pack.pdf"), Sub(options) options.PdfOptions.PdfFormat = PdfFormats.PdfA_2B)Run it, and output/report-pack.pdf holds the pages of every document in the folder, one after another.
How It Works
1. Convert. Each converter reads one format and writes PDF. The program picks the converter by file extension and names each PDF after its source, extension included, so report.docx and report.xlsx don’t overwrite each other. PDF files in the folder are copied as they are. To accept more formats, add a case for another converter, such as DocToPdfConverter for legacy Word documents or HtmlToPdfConverter for web pages.
2. Merge. JoinPdf takes a source PDF and a list of PDFs to append after it, in order. Save the result to a path with a folder, as here: with a bare file name, the merge plugins write into an Output folder next to your application.
3. Archive. PdfToPdfAConverter writes PDF/A, the ISO standard for documents that must stay readable without the software that created them: fonts are embedded and nothing depends on external resources. Without options it writes PDF/A-1a. The program asks for PDF/A-2b, a common choice for archives: level b guarantees that the document looks the same, and part 2 allows features such as transparency and layers that part 1 does not.
Check the Result
Validate the archive with veraPDF, the open-source PDF/A validator. With Docker you don’t have to install it:
docker run --rm -v "$PWD/output:/data" verapdf/cli --format text /data/report-pack.pdfFor the program above, it prints:
PASS /data/report-pack.pdf 2bVariations
- No archive needed? Stop after step 2 and use
output/merged.pdf. - Need a password? PDF/A doesn’t allow encryption. Keep the archive unencrypted and control access where it is stored.
- Working with streams? Every converter also reads from and writes to a
Stream.JoinPdfcan take its source document from aStream; the documents it appends and the result are file paths.
Licensing
The program uses five plugins, and each one is licensed separately: DOCX to PDF, XLSX to PDF, PPTX to PDF, and PDF to PDF/A from GroupDocs.Conversion.LowCode, and Merge PDF from GroupDocs.Merger.LowCode. Each costs a one-time $99 per developer.
Without licenses, the program still runs in evaluation mode: each plugin processes only the first three pages and adds an evaluation message, so the pack has three pages. To test the whole pipeline without these limits, request a free temporary license.
Learn More
- Introducing GroupDocs.Conversion.LowCode and GroupDocs.Merger.LowCode
- Using JoinPdf to Merge PDF Documents and Using the PDF to PDF/A Converter in the documentation
- How to Merge PDF Files in .NET in the Knowledge Base
- Document Conversion Plugins and Document Merger Plugins
Questions? Ask on the Community Forum.