Set PDF version 1.7 for PDF/A 2 and 3

#348
This commit is contained in:
Ben Olden-Cooligan 2024-04-06 13:28:47 -07:00
parent b1736fdd71
commit 8e3ea2a4d8

View File

@ -21,6 +21,9 @@ namespace NAPS2.Pdf;
/// </summary>
public class PdfExporter
{
private const int PDF_VERSION_14 = 14;
private const int PDF_VERSION_17 = 17;
private readonly ScanningContext _scanningContext;
private readonly ILogger _logger;
@ -312,6 +315,12 @@ public class PdfExporter
PdfAHelper.CreateXmpMetadata(document, compat);
}
document.Version = compat switch
{
PdfCompat.PdfA2B or PdfCompat.PdfA3B or PdfCompat.PdfA3U => PDF_VERSION_17,
_ => PDF_VERSION_14
};
var stream = new MemoryStream();
document.Save(stream);
return stream;