PDF-Merge/scratch.cs
2024-07-31 15:47:23 -04:00

29 lines
749 B
C#

using System;
using System.IO;
using System.Linq;
using QuestPDF.Fluent;
using QuestPDF.Infrastructure;
class Program
{
static void Main(string[] args)
{
// 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 = 1; i < args.Length; i++)
{
var inputDocument = new Document(new FileStream(args[i], FileMode.Open));
document.Append(inputDocument.GetContent());
}
// Save the output document
document.Save();
File.WriteAllBytes("merged.pdf", stream.ToArray());
}
}
}