Last active
May 4, 2021 19:02
-
-
Save GroupDocsGists/a5fbd8bfba0cfddd998cd60a3089e584 to your computer and use it in GitHub Desktop.
Merge two or more difference types of files into one file in C# using .NET API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Combine two or more different types of files into one using C# | |
using (Merger merger = new Merger("document.pdf")) | |
{ | |
merger.Join("document.docx"); | |
merger.Join("spreadsheet.xlsx"); | |
merger.Save("merge_document.pdf"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Combine selective pages of two or more different types of files into one using C# | |
using (Merger merger = new Merger("document.pdf")) | |
{ | |
// Merge first page of DOCX file | |
JoinOptions joinOptions = new JoinOptions(new int[] {1}); | |
merger.Join("document.docx", joinOptions); | |
// Merge all the even pages/sheets of the spreadsheet from the provided range | |
joinOptions = new JoinOptions(1,2, RangeMode.EvenPages); | |
merger.Join("spreadsheet.xlsx", joinOptions); | |
merger.Save("merge_document.pdf"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment