DEV Community

Atir Tahir
Atir Tahir

Posted on

How to merge different type of files into a single PDF in .NET

Why to merge different documents?
There are a lot of common yet crucial reasons to merge documents. Let's understand the need with a use-case:

Real estate
When you buy or lease a property, you have to go through a lot of documentation (e.g. mortgage, loan application, agreements, various expense recordings). Such a documentation is mostly recorded in multiple file formats (e.g. PDF, Word, Excel, Presentation). Isn't it super if you compile all the documents into a single understandable format such as PDF.

About the API
GroupDocs.Merger for .NET is a back-end, UI-Agnostic API that could easily be integrated or implemented in any (new or existing) .NET application irrespective of platform and framework dependencies.

Implementation
Please have a look at the code below:

using (Merger merger = new Merger(@"c:\document1.pdf"))
{
    merger.Join(@"c:\document2.doc");
    merger.Join(@"c:\document3.ppt");
    merger.Join(@"c:\document4.xls");

    merger.Save(@"c:\merged.pdf");
}
Enter fullscreen mode Exit fullscreen mode

Get the DLL here and in case of any issue, you can get help from free support forum.

Top comments (0)