Closed jlfjunior closed 4 years ago
Hi, you should use the dependency injection...i dont know wha tis your use case, but in the constructor of your class you should add the interface IGeneratePdf, use it accordingly and then the project that use the library in should add in the the startup this line services.AddWkhtmltopdf();
would like do do so.
public byte[] MontaBytesPDF(bool convertLinhaDigitavelToImage = false, string urlImagemLogoBeneficiario = null)
{
#if NETSTANDARD2
return (new Wkhtmltopdf.NetCore.HtmlAsPdf().GetPDF(MontaHtmlEmbedded(convertLinhaDigitavelToImage, true,
urlImagemLogoBeneficiario)));
#elif NETCOREAPP3
return (new Wkhtmltopdf.NetCore.IGeneratePdf().GetPDF(MontaHtmlEmbedded(convertLinhaDigitavelToImage,
true, urlImagemLogoBeneficiario)));
#else
throw new NotImplementedException();
#endif
}
Can you send an example using project Class Library ?
I have a function in an project classlib, how can i using ?