refactor(PdfMergeBehavior): update to use SaveToStream instead of ConvertToPDFA

This commit is contained in:
tekh 2025-11-12 13:51:49 +01:00
parent e68965543e
commit 2dfa1de7e1

View File

@ -12,12 +12,6 @@ namespace EnvelopeGenerator.Application.Pdf.Behaviors;
/// </summary> /// </summary>
public class PdfMergeBehavior : IPipelineBehavior<BurnPdfCommand, byte[]> public class PdfMergeBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
{ {
private static readonly bool ALLOW_RASTERIZATION = true;
private static readonly bool ALLOW_VECTORIZATION = true;
private static readonly PdfConversionConformance PDFAConformanceLevel = PdfConversionConformance.PDF_A_1b;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -77,7 +71,7 @@ public class PdfMergeBehavior : IPipelineBehavior<BurnPdfCommand, byte[]>
throw new MergeDocumentException($"Documents could not be merged: {oStatus}"); throw new MergeDocumentException($"Documents could not be merged: {oStatus}");
// Convert to PDF/A // Convert to PDF/A
oMergedPDF.ConvertToPDFA(oFinalStream, PDFAConformanceLevel, ALLOW_VECTORIZATION, ALLOW_RASTERIZATION); oMergedPDF.SaveToStream(oFinalStream);
oStatus = oDocumentPDF.GetStat(); oStatus = oDocumentPDF.GetStat();
if (oStatus != GdPictureStatus.OK) if (oStatus != GdPictureStatus.OK)
throw new MergeDocumentException($"Document could not be converted to PDF/A: {oStatus}"); throw new MergeDocumentException($"Document could not be converted to PDF/A: {oStatus}");