0
I am with another question now, I am trying to use Pdfsharp Htmlrenderer, to generate a pdf, to send by email. I downloaded the nuget package, and function is like this:
public static Byte[] PdfSharpConvert(String html)
{
Byte[] res = null;
using (MemoryStream ms = new MemoryStream())
{
var pdf = TheArtOfDev.HtmlRenderer.PdfSharp.PdfGenerator.GeneratePdf(html, PdfSharp.PageSize.A4);
pdf.Save(ms);
res = ms.ToArray();
}
return res;
}
What happens, all my items I need to be generated PDF, is generated in a div on the front. I wanted to pass this information from the front to the back, so that the PDF is generated, is it possible ? I don’t even necessarily need to save this pdf, it might be something temporary, to send by email. I’m a little lost in the Pdfsharp library, I’m reading the documents but I’m more confused rs.
I did the test here @Matheus, but it only comes out a sheet, and will have cases that will take more than one sheet, and also this div was with
style="display: none;"
, and then returned error, I had to take to be able to generate, and yet it was not the right way– Mariana
Can you post an example of how you needed it and how you’re doing ?
– Matheus
Matheus managed to make it work, but I will not use this option, thank you.
– Mariana