diff --git a/src/UglyToad.PdfPig/Writer/PdfMerger.cs b/src/UglyToad.PdfPig/Writer/PdfMerger.cs
index 1abe0d93..d46d1625 100644
--- a/src/UglyToad.PdfPig/Writer/PdfMerger.cs
+++ b/src/UglyToad.PdfPig/Writer/PdfMerger.cs
@@ -19,11 +19,11 @@
///
/// Merge two PDF documents together with the pages from followed by .
///
- public static byte[] Merge(string file1, string file2, IReadOnlyList file1Selection = null, IReadOnlyList file2Selection = null)
+ public static byte[] Merge(string file1, string file2, IReadOnlyList file1Selection = null, IReadOnlyList file2Selection = null, PdfAStandard archiveStandard = PdfAStandard.None)
{
using (var output = new MemoryStream())
{
- Merge(file1, file2, output, file1Selection, file2Selection);
+ Merge(file1, file2, output, file1Selection, file2Selection, archiveStandard);
return output.ToArray();
}
}
@@ -31,7 +31,7 @@
///
/// Merge two PDF documents together with the pages from followed by into the output stream.
///
- public static void Merge(string file1, string file2, Stream output, IReadOnlyList file1Selection = null, IReadOnlyList file2Selection = null)
+ public static void Merge(string file1, string file2, Stream output, IReadOnlyList file1Selection = null, IReadOnlyList file2Selection = null, PdfAStandard archiveStandard = PdfAStandard.None)
{
_ = file1 ?? throw new ArgumentNullException(nameof(file1));
_ = file2 ?? throw new ArgumentNullException(nameof(file2));
@@ -40,7 +40,7 @@
{
using (var stream2 = File.OpenRead(file2))
{
- Merge(new[] { stream1, stream2 }, output, new[] { file1Selection, file2Selection });
+ Merge(new[] { stream1, stream2 }, output, new[] { file1Selection, file2Selection }, archiveStandard);
}
}
}
@@ -49,10 +49,18 @@
/// Merge multiple PDF documents together with the pages in the order the file paths are provided.
///
public static byte[] Merge(params string[] filePaths)
+ {
+ return Merge(PdfAStandard.None, filePaths);
+ }
+
+ ///
+ /// Merge multiple PDF documents together with the pages in the order the file paths are provided.
+ ///
+ public static byte[] Merge(PdfAStandard archiveStandard, params string[] filePaths)
{
using (var output = new MemoryStream())
{
- Merge(output, filePaths);
+ Merge(output, archiveStandard, filePaths);
return output.ToArray();
}
}
@@ -60,7 +68,15 @@
///
/// Merge multiple PDF documents together with the pages in the order the file paths are provided into the output stream
///
- public static void Merge(Stream output, params string[] filePaths)
+ public static void Merge(Stream output, params string[] filePaths)
+ {
+ Merge(output, PdfAStandard.None, filePaths);
+ }
+
+ ///
+ /// Merge multiple PDF documents together with the pages in the order the file paths are provided into the output stream
+ ///
+ public static void Merge(Stream output, PdfAStandard archiveStandard, params string[] filePaths)
{
var streams = new List(filePaths.Length);
try
@@ -71,7 +87,7 @@
streams.Add(File.OpenRead(filePath));
}
- Merge(streams, output, null);
+ Merge(streams, output, null, archiveStandard);
}
finally
{
@@ -85,13 +101,13 @@
///
/// Merge the set of PDF documents.
///
- public static byte[] Merge(IReadOnlyList files, IReadOnlyList> pagesBundle = null)
+ public static byte[] Merge(IReadOnlyList files, IReadOnlyList> pagesBundle = null, PdfAStandard archiveStandard = PdfAStandard.None)
{
_ = files ?? throw new ArgumentNullException(nameof(files));
using (var output = new MemoryStream())
{
- Merge(files.Select(f => PdfDocument.Open(f)).ToArray(), output, pagesBundle);
+ Merge(files.Select(f => PdfDocument.Open(f)).ToArray(), output, pagesBundle, archiveStandard);
return output.ToArray();
}
}
@@ -104,20 +120,22 @@
///
/// Must be writable
///
+ ///
///
- public static void Merge(IReadOnlyList streams, Stream output, IReadOnlyList> pagesBundle = null)
+ public static void Merge(IReadOnlyList streams, Stream output, IReadOnlyList> pagesBundle = null, PdfAStandard archiveStandard = PdfAStandard.None)
{
_ = streams ?? throw new ArgumentNullException(nameof(streams));
_ = output ?? throw new ArgumentNullException(nameof(output));
- Merge(streams.Select(f => PdfDocument.Open(f)).ToArray(), output, pagesBundle);
+ Merge(streams.Select(f => PdfDocument.Open(f)).ToArray(), output, pagesBundle, archiveStandard);
}
- private static void Merge(IReadOnlyList files, Stream output, IReadOnlyList> pagesBundle)
+ private static void Merge(IReadOnlyList files, Stream output, IReadOnlyList> pagesBundle, PdfAStandard archiveStandard = PdfAStandard.None)
{
var maxVersion = files.Select(x=>x.Version).Max();
using (var document = new PdfDocumentBuilder(output, false, PdfWriterType.Default, maxVersion))
{
+ document.ArchiveStandard = archiveStandard;
foreach (var fileIndex in Enumerable.Range(0, files.Count))
{
var existing = files[fileIndex];