DinkToPdf
DinkToPdf copied to clipboard
Recipe for (azure) asp core app service x86/x64
Here's a recipe for DinkToPdf/Wkhtmltopdf in an asp core app service. Also works fine on Azure: https://github.com/Casimodo72/Casimodo.Lib/tree/master/src/Casimodo.Lib.Web.Pdf.AppService
Local debug: I use the "Debug|x64" configuration, because I just can't make the app work with IIS Express when targeting x86.
Azure: I use the "Release|x86" configuration.
The project will automatically use wkhtmltox-x64 when the "Debug" config is used and wkhtmltox-x86 when "Release" is used.
<ItemGroup Condition="'$(Configuration)' == 'Debug'">
<None Include="./lib/Wkhtmltopdf/wkhtmltox-x64.dll" Link="libwkhtmltox.dll" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'Release'">
<None Include="./lib/Wkhtmltopdf/wkhtmltox-x86.dll" Link="libwkhtmltox.dll" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
Plase also note that this uses a custom DinkToPdf build, because I changed DinkToPdf.ObjectSettings: Added and using property RawContent in order to feed the converter also with a byte array instead of a string. In my scenario the input is already a byte array. If you don't need that change, then remove the assembly reference to DinkToPdf and just add the DinkToPdf NuGet package.