You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a .NET 6 Web API project with DinkToPdf which I use on macOS on my dev machine, and two servers on Linux Ubuntu 20.4 and Windows Server 2012. My API detects OS on which it runs and uses the corresponding library to convert HTML to PDF file on output.
My controller:
publicclassClientDocController:BaseController{privatereadonlyIClientAppointmentDocumentService_clientAppointmentDocumentService;privatereadonlyIConverter_htmlToPdfConverter;publicClientDocController(IClientAppointmentDocumentServiceclientAppointmentDocumentService,IConverterhtmlToPdfConverter){_clientAppointmentDocumentService=clientAppointmentDocumentService;_htmlToPdfConverter=htmlToPdfConverter;}[HttpGet("{documentId}/pdf/")][RestApiAuthorize(AccountRolePermissions.VIEW_CLIENT_DOCUMENTS)]publicasyncTask<IActionResult>GetPdfAsync([FromRoute]intdocumentId,booluploadToClientPortal,int?templateId=null,boolclientPrint=false,boolsendToClientEmail=false,CancellationTokencancellationToken=default){try{varhtmlDocument=templateId==null?await _clientAppointmentDocumentService.GetDefaultHtmlDocumentAsync(documentId, clientPrint, cancellationToken):await _clientAppointmentDocumentService.GetHtmlDocumentAsync(documentId, templateId, clientPrint, cancellationToken);varfileName=$"Document_{documentId}_{DateTime.Now:s}.pdf";varconversionSettings= PdfConfigurationDefaults.GetDefaultSettings(htmlDocument);//this get individual settings for each platformvarpdf= _htmlToPdfConverter.Convert(conversionSettings);varresult= File(pdf, MediaTypeNames.Application.Pdf, fileName);if(sendToClientEmail)await _clientAppointmentDocumentService.SendToClientByEmailAsync(new[]{result});if(!uploadToClientPortal)returnresult;varaccessToken= Request.Headers["Authorization"].ToString();varresponse=await _clientAppointmentDocumentService.UploadToClientPortalAsync(documentId, result, accessToken);return Ok(response);}catch(Exceptione){return BadRequest(e.Message);}}}
This works well on all machines, although on Linux server there are images not included in resulting PDF under tag <img src="https://..." />.
What I have checked:
This is not SSL problem because if I make this controller to output HTML then images are shown as expected
I have tried every setting (maybe not in all combinations) in conversionSettings without any success
Converting images into base64 string also didn't help. Images didn't shown
Different image types from other hosts, didn't help
Anybody have any ideas, what can I check further?
The text was updated successfully, but these errors were encountered:
I have the same problem. I'm trying to display an image from Azure Blob storage, and it won't render the image. It just shows a blank box.
Has anyone found a solution for this yet?
I have a .NET 6 Web API project with DinkToPdf which I use on macOS on my dev machine, and two servers on Linux Ubuntu 20.4 and Windows Server 2012. My API detects OS on which it runs and uses the corresponding library to convert HTML to PDF file on output.
My controller:
This works well on all machines, although on Linux server there are images not included in resulting PDF under tag
<img src="https://..." />
.What I have checked:
Anybody have any ideas, what can I check further?
The text was updated successfully, but these errors were encountered: