-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/tossnet/Blazor-PdfSharpCore
- Loading branch information
Showing
6 changed files
with
122 additions
and
42 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace Share.PDF; | ||
|
||
using PdfSharpCore.Pdf.IO; | ||
using PdfSharpCore.Pdf; | ||
public class Tools | ||
{ | ||
|
||
public static PdfDocument Combine(MemoryStream pdf, PdfDocument combineDocument) | ||
{ | ||
// Open the document to import pages from it. | ||
PdfDocument inputDocument = PdfReader.Open(pdf, PdfDocumentOpenMode.Import); | ||
|
||
// Iterate pages | ||
int count = inputDocument.PageCount; | ||
for (int idx = 0; idx < count; idx++) | ||
{ | ||
// Get the page from the external document... | ||
PdfPage page = inputDocument.Pages[idx]; | ||
// ...and add it to the output document. | ||
combineDocument.AddPage(page); | ||
} | ||
|
||
return combineDocument; | ||
} | ||
} |