fpanaccia / Wkhtmltopdf.NetCore.Example-deprecated

Implementation of Wkhtmltopdf.NetCore
81 stars 33 forks source link

/app/{GUID}.pdf file not found exception in Linux Docker Compose on .NET5 #16

Closed blushmaq closed 3 years ago

blushmaq commented 3 years ago

Using Wkhtmltopdf.NetCore 5.0.2-preview

I'm getting an exception of pdf file not found while running on docker-compose linux container. I can see an html file created in the root directory(/app) of the container. But it is not being able to generate pdf out of if. Exception I'm getting is below

Could not find file '/app/c4a6d426-1cd8-4e08-90c3-64067b1b9a56.pdf'.

at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at Wkhtmltopdf.NetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html) at Wkhtmltopdf.NetCore.GeneratePdf.GetPDF(String html)

blushmaq commented 3 years ago

Also, I have to configure Wkhtmltopdf in startup file as below. Otherwise it takes the path of bin/debug to search for wkhtmltopdf

services.AddWkhtmltopdf("/app/Rotativa/");

blushmaq commented 3 years ago

Changing the docker image from aspnet:5.0-buster-slim to aspnet:5.0-buster-slim-amd64 solved issue

renerlemes commented 2 years ago

@blushmaq could you send the Dockerfile. In my code, not work the docker image