Added a different example to the scratch file.
This commit is contained in:
parent
3337dc4ea6
commit
e7cec66e6c
35
scratch.cs
35
scratch.cs
@ -26,3 +26,38 @@ class Program
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using QuestPDF.Fluent;
|
||||||
|
using QuestPDF.Infrastructure;
|
||||||
|
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void MergePdfFiles(string[] filePaths, string outputPath)
|
||||||
|
{
|
||||||
|
// Create a new PDF document
|
||||||
|
using (var stream = new MemoryStream())
|
||||||
|
{
|
||||||
|
var document = new Document(stream);
|
||||||
|
|
||||||
|
// Add each PDF document to the output document
|
||||||
|
for (int i = 0; i < filePaths.Length; i++)
|
||||||
|
{
|
||||||
|
var inputDocument = new Document(new FileStream(filePaths[i], FileMode.Open));
|
||||||
|
document.Append(inputDocument.GetContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save the output document
|
||||||
|
document.Save();
|
||||||
|
File.WriteAllBytes(outputPath, stream.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
string[] filePaths = { "input1.pdf", "input2.pdf", "input3.pdf" };
|
||||||
|
string outputPath = "merged.pdf";
|
||||||
|
MergePdfFiles(filePaths, outputPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user