Hello - I am using the latest versions of EO.PDF and EO.WebBrowser (v20.2.34). I have EO.Base.Runtime.EnableEOWP=true and HtmlToPdf.MaxConcurrentTaskCount=4 (I've included eowp.exe in the bin folder at compile-time). I have included the 4 files EO.Pdf, EO.WebBrowser, EO.Base, EO.WebEngine as VS Project References (directly from the DLL's)
I have a .NET Core 3.1 Web API that is generating a PDF as expected when I issue the following command
Code: C#
HtmlToPdf.ConvertHtml(myHtml, @"c:\temp\myPdf.pdf");
- this generates a file of above 100K
...however when I issue the following I get a PDF with just one page which is blank
Code: C#
byte[] bytes = null;
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
HtmlToPdf.ConvertHtml(myHtml, stream);
stream.Position = 0;
bytes = stream.ToArray();
stream.Position = 0;
}
- this generates a byte array of around 40K length
...I have also tried the following with the same result (PDF generated with just one page which is blank)
Code: C#
byte[] bytes = null;
System.IO.MemoryStream stream = new System.IO.MemoryStream();
var pdfDocument = new EO.Pdf.PdfDocument();
HtmlToPdf.ConvertHtml(myHtml, pdfDocument);
pdfDocument.Save(@"c:\temp\myPdfUsingPdfDocument.pdf"); //check if pdfDocument contains anything - it doesn't - file is about 40K in size
pdfDocument.Save(stream);
stream.Position = 0;
bytes = stream.ToArray();
stream.Position = 0;
- this also generates a byte array of around 40K length
Notes
====
(i) I'm trying to generate an Angular template - all of the above strategies work when I use the code in .NET Framework however as mentioned only the first works in .NET Core
(ii) I generate the Angular template before passing through to the above PDF generate steps and all resolves in a browser without any console errors
(iii) if I use a very simple HTML snippet (eg. "<span>Hello</span>") the generate works in all scenarios - I have tried to dumb down the Angular template to bare bones but it ultimately it has all of the Angular wrapping (main, polyfills, syles, etc)
Do you have any ideas why the first code snippet works but the other two don't