fpanaccia / Wkhtmltopdf.NetCore.Example-deprecated

Implementation of Wkhtmltopdf.NetCore
82 stars 33 forks source link

Can't use library with View in dotnet core 3.1 #5

Closed dj-Query closed 4 years ago

dj-Query commented 4 years ago

Hi, I'm testing the library on a Windows 10 environment with dotnet core 3.1. Tests using the GetPDF method work. Tests using a view fail.

This is the code:

        public async Task<IActionResult> GetByteArray()
        {
            var data = new Panel
            {
                Descr = "This is a test",
                Id = 123456
            };

            var pdf = await _generatePdf.GetByteArray<Panel>("Views/Test.cshtml", data);
            var pdfStream = new System.IO.MemoryStream();
            pdfStream.Write(pdf, 0, pdf.Length);
            pdfStream.Position = 0;
            return new FileStreamResult(pdfStream, "application/pdf");
        }

image

dj-Query commented 4 years ago

it didn't work because I was tinkering around and removed some necessary dll. I had to reinstall Microsoft Visual C++ Redistributable to fix the problem