A “Hello, World!” example is often the first step when exploring GroupDocs.Merger for Python via .NET. It serves as a simple test to confirm that your development environment is correctly set up and that the library is functioning as expected.
Overview
GroupDocs.Merger for Python via .NET joins documents into one, splits them, and extracts, removes, moves and rotates their pages. A wide range of supported formats makes it versatile for different use cases.
How to merge two documents
The following steps demonstrate how to merge two PDF documents using GroupDocs.Merger for Python via .NET:
Import the Merger class from groupdocs.merger.
Open a Merger with the path to the first document.
Append the second document with join().
Save the result with save().
Complete example
The example below appends one PDF document to another and saves both as a single PDF:
fromgroupdocs.mergerimportMergerdefhello_world():# Open the first document, append the second one, and save the resultwithMerger("./input.pdf")asmerger:merger.join("./input2.pdf")merger.save("./output.pdf")print("Documents merged successfully. Output saved to ./output.pdf.")if__name__=="__main__":hello_world()
input.pdf is a sample file used in this example. Click here to download it.
input2.pdf is a sample file used in this example. Click here to download it.
The result keeps the format of the first document: output.pdf holds the three pages of input.pdf followed by the two pages of input2.pdf. Without a license, GroupDocs.Merger runs in evaluation mode, so the result holds the first three pages only and carries an evaluation notice: see Licensing and Evaluation.
The same three calls merge Word documents, spreadsheets, presentations, images and other formats: Merge files has an example for each, with the options each format takes.
Additional resources
This demo references the GroupDocs.Merger for Python via .NET code samples.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.
On this page
Ask AI
Ask anything about this page — the answer is based on its content.
Searching the docs and writing an answer…
Something went wrong while getting an answer. Please try again in a moment.