Compare commits

...

1 Commits

Author SHA1 Message Date
54799f54ec Add #if !NET8 back in to pass the .net core tests 2025-05-28 13:42:05 -07:00

View File

@ -1,6 +1,8 @@
#if !NET8
using iTextSharp.text; using iTextSharp.text;
using iTextSharp.text.html.simpleparser; using iTextSharp.text.html.simpleparser;
using iTextSharp.text.pdf; using iTextSharp.text.pdf;
#endif
using System.IO; using System.IO;
@ -31,6 +33,7 @@ public class StandardPdfRenderer {
public static MemoryStream GetPortableDocumentFormat(string pageTitle, string htmlText) { public static MemoryStream GetPortableDocumentFormat(string pageTitle, string htmlText) {
MemoryStream result = new(); MemoryStream result = new();
#if !NET8
using (Document pdfDocument = new Document(PageSize.A4, HorizontalMargin, HorizontalMargin, VerticalMargin, VerticalMargin)) { using (Document pdfDocument = new Document(PageSize.A4, HorizontalMargin, HorizontalMargin, VerticalMargin, VerticalMargin)) {
using (PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDocument, result)) { using (PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDocument, result)) {
pdfWriter.CloseStream = false; pdfWriter.CloseStream = false;
@ -43,6 +46,7 @@ public class StandardPdfRenderer {
} }
} }
} }
#endif
return result; return result;
} }