I strictly follow this sample: https://odetocode.com/blogs/scott/archive/2018/02/14/pdf-generation-in-azure-functions-v2.aspx
I download the three files from the DinkToPdf repository
Problem is when I add either 32bit OR 64bit DLLs, I get the following error:
One or more errors occurred. (An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B))
on this code in particular:
private static byte[] BuildPdf(string html)
{
byte[] arr = null;
try
{
arr = pdfConverter.Convert(new HtmlToPdfDocument() { Objects = { new ObjectSettings { HtmlContent = html } } });
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex);
}
return arr;
}
My Azure Function V2 .net Core project is set to Any CPU with no option for other. I saw other posts on Stack Overflow about this error and I feel that this is different because other people are talking about two projects that have control over and there is some differences in the architecture, but here I just point a few binaries and no matter if they are 32 or 64 the error stays. Also I saw that some people change settings of the IIS and I don't have such. Any ideas? Thanks!