rdvojmoc / DinkToPdf

C# .NET Core wrapper for wkhtmltopdf library that uses Webkit engine to convert HTML pages to PDF.
MIT License
1.08k stars 415 forks source link

Text not displayed correctly in Azure instance #39

Closed teocomi closed 6 years ago

teocomi commented 6 years ago

Hello, the library is working fine locally when debugging with IIS, but when deployed to Azure the text is displayed as black boxes. I've tried to manually set a font face and it made no difference. Any ideas?

image

rdvojmoc commented 6 years ago

To me this looks like that fonts that your application is using are missing on Azure instance.

teocomi commented 6 years ago

Thanks for the quick reply! I haven't explicitly set any font family for the text so it should use a default font family like times new roman or arial, no?

rdvojmoc commented 6 years ago

Yeah, it should, can you check if they are installed on your Azure instance?

teocomi commented 6 years ago

It seems that the sandbox Azure web apps run into is the problem, as it doesn't allow GDI+. See: https://gist.github.com/tmakin/80e1905094245c857c493b7879657095#gistcomment-2068640

It's working fine from an Azure Function: https://odetocode.com/blogs/scott/archive/2018/02/14/pdf-generation-in-azure-functions-v2.aspx

Thanks again!

mikeaxle commented 6 years ago

@teocomi how did you deploy it azure? When I deploy an asp core 2 api from visual studio mac, the api route with this extension has a general 500 error....

teocomi commented 6 years ago

@mikeaxle you should maybe debug it locally then, make sure to follow the article above that uses azure functions v2.

mikeaxle commented 6 years ago

@teocomi I have it working properly locally. What I am asking specifically is when you deployed it, what steps did you take? did you have to load up the 'libwkhtmltox' binaries? and where did you store them? I'll have a look at the azure functions link too.

teocomi commented 6 years ago

@mikeaxle I Just put libwkhtmltox.dll in the root folder of my project and clicked publish in VS, nothing else...

honeykatrina commented 5 years ago

Hello, for me also the library works fine locally in my .Net Core web api. After that I deploy my app to Azure App Service, F1: Free service plan. To use 32 bit version in Azure I use this response https://github.com/rdvojmoc/DinkToPdf/issues/5#issuecomment-322725241 As a result I also see black squares instead of text image I have tried to deploy with specified font family in the project in ObjectSettings, and without it. Could anyone explain how to solve it? @teocomi does it work because you use Azure Function?

Update: I tried to deploy with another service plan: "Shared", and I checked which type of converter I use: SynchronizedConverter services.AddSingleton(typeof(IConverter), new SynchronizedConverter(new PdfTools())); in my Startup.