Converting HTML to PDF using Blink in a Linux docker container fails in an Azure App Service

The example code for converting HTML to PDF using Blink in a Linux docker container fails in an Azure App Service. It works locally but fails in an Azure App Service. The service plan being used is Premium V2 P1v2.


The following exception is thrown:

Syncfusion.Pdf.PdfException: Failed to convert webpage

at Syncfusion.HtmlConverter.BlinkConverter.ConvertToPdf(String url, PdfDocument& document)

at Syncfusion.HtmlConverter.BlinkConverter.<>c__DisplayClass161_0.<Convert>b__0()


Source Code

https://www.syncfusion.com/downloads/support/directtrac/general/ze/BlinkLinuxDockerV3.1530181728

Taken from:  https://www.syncfusion.com/kb/11299/how-to-convert-html-to-pdf-using-blink-in-linux-docker


18 Replies

PV Prakash Viswanathan Syncfusion Team July 27, 2021 10:50 AM UTC

Hi Paul, 

Thank you for contacting Syncfusion support.  

We have already checked the conversion in Azure app service using Linux docker with Blink rendering engine. We have published KB article for the sample, please refer below KB link. 

We have checked the provided sample in our side, it is working fine in local machine (both from VS and PowerShell). Can you please share us the steps which you used to deploy the application with docker to Azure app service, it will be helpful for us to analyse and assist you further on this.  

Regards, 
Prakash V 



PA Paul July 27, 2021 01:53 PM UTC

Here is the yaml for our deployment pipeline:

# Variable 'image_name' was defined in the Variables tab
# Variable 'image_tag' was defined in the Variables tab
trigger:
  branches:
    include:
    - refs/heads/main
  paths:
    exclude:
    - Test
  batchTrue
name$(date:yyyyMMdd)$(rev:.r)
jobs:
jobJob_1
  displayNameAgent job 1
  pool:
    vmImageubuntu-20.04
  steps:
  - checkoutself
  - taskDotNetCoreCLI@2
    displayNameRestore packages
    inputs:
      commandrestore
      projects'**/*.csproj'
  - taskDotNetCoreCLI@2
    displayNameBuild projects
    inputs:
      projects'**/*.csproj'
      arguments--no-restore
  - taskDotNetCoreCLI@2
    displayNameRun tests
    enabledFalse
    inputs:
      commandtest
      projects'**/*.csproj'
  - taskDocker@1
    displayNameBuild image
    inputs:
      containerregistrytypeContainer Registry
      dockerFileBlinkLinuxDockerV3.1/Dockerfile
      imageName$(image_name):$(image_tag)
      qualifyImageNamefalse
      includeSourceTagstrue
  - taskDocker@1
    displayNameTag image
    inputs:
      azureSubscriptionEndpoint#scrubbed
      azureContainerRegistry#scrubbed
      commandTag image
      imageName$(image_name):$(image_tag)
      buildContext'**'
  - taskDocker@1
    displayNamePush image
    inputs:
      azureSubscriptionEndpoint#scrubbed
      azureContainerRegistry#scrubbed
      commandPush an image
      imageName$(image_name):$(image_tag)
      includeSourceTagstrue
...



GK Gowthamraj Kumar Syncfusion Team July 28, 2021 12:35 PM UTC

Hi Paul, 
 
Thank you for sharing the details.

 
Meanwhile, Could you please share us the steps which you used to deploy the application with docker to Azure app service, it will be helpful for us to analyse and assist you further on this.   
 
Regards, 
Gowthamraj K 



PA Paul July 28, 2021 01:58 PM UTC

We created an Azure Devops pipeline that corresponds to the yaml I supplied above and manually ran it. The pipeline pulls the code from the SyncFusion sample repo, builds it, and pushes the resulting image to an Azure container registry. The container was then manually deployed to an Azure app service.



PV Prakash Viswanathan Syncfusion Team July 29, 2021 03:34 PM UTC

Hi Paul, 

Currently, we are working on this with provided details and we will update you with further details by Aug 2, 2021.  

Regards, 
Prakash V 



GK Gowthamraj Kumar Syncfusion Team August 2, 2021 12:36 PM UTC

Hi Paul, 
 
We regret the inconvenience caused.  
 
We already deployed the HTML to PDF converter with docker in Azure. We build and push the image to docker hub and deployed from there manually and it is working fine with that. We are still configuring the pipe to check the conversion and we will update further details by August 4, 2021.  
 
However, the reported failure may occurs due to resource shortage, can you please try increase the storage, hosting plan and update us the details. It will be helpful for us to analyse and assist you further on this.  
 
Regards, 
Gowthamraj K


PA Paul August 2, 2021 06:30 PM UTC

We deployed again to a P2V2 service plan with the same results. 

P2V2 => 2 cores, 7GB RAM, 250GB storage



GK Gowthamraj Kumar Syncfusion Team August 3, 2021 12:15 PM UTC

Hi Paul,  
  
Thank you for your update.  
 
As we said earlier, we are still configuring the pipe to check the conversion and we will update further details by August 4th, 2021.   
  
Regards, 
Gowthamraj K 



GK Gowthamraj Kumar Syncfusion Team August 4, 2021 03:01 PM UTC

Hi Paul, 
 
We have checked the reported issue with the provided sample from initial update on this forum, it is working fine in our side. We have pushed the docker image to docker hub, can you please try the conversion with below docker image and let us know the result.  
 
The above docker image is created with the sample which you have shared in your first update. Kindly deploy the docker image to azure app service from docker hub manually and let us know the result. We are working on to push the images to azure container service and deploy to azure app service and we will update further details by August  5th , 2021. 
 
Regards, 
Gowthamraj K 



PA Paul August 4, 2021 06:25 PM UTC

The Azure app service conversion works using the image you pushed to docker hub.


PV Prakash Viswanathan Syncfusion Team August 5, 2021 04:44 PM UTC

Hi Paul, 

The reported issue may occurs, if the docker image is not build properly with the pre-requisites. Can you please try the conversion by manually build the docker image from docker file, push the docker image to docker hub/azure container registry. Then deploy the docker image to Azure app service with Linux docker and update us the details. Also, please compare the docker image size which is built manually and yml file.  

If possible, kindly push the docker image to docker hub or share the manual steps to build the docker image which is equivalent to your yml file action, it will be helpful for us to analyse and assist you further on this.  

We are still working on to push the docker image to ACR and trying to deploy as Azure App Service. We will update further details on or before Aug 9, 2021.   

Regards, 
Prakash V 



GK Gowthamraj Kumar Syncfusion Team August 6, 2021 01:05 PM UTC

Hi Paul, 
 
We have built and push the docker image to Azure Container Registry, from there we deployed it to azure app service. The application is working fine in our side, we have shared the link of azure app service for your reference. As we said earlier, please check the docker image by building manually and deploying manually to azure. The reported issue may occurs if the docker image is not built properly.  
 
Note: The above web application will be removed by Monday 2 PM IST. So, kindly check and update us the details.  
 
Regards, 
Gowthamraj K 



PA Paul August 6, 2021 07:36 PM UTC

Can you share the Azure DevOps pipeline that was used to build/deploy the container? 


GK Gowthamraj Kumar Syncfusion Team August 9, 2021 12:41 PM UTC

Hi Paul, 
 
Thank you for your update.

 
We manually built and deploy the application with docker image. We did not used with azure devops pipeline, kindly try build and deploy manually and update us the details.  
 
Regards, 
Gowthamraj K 



PA Paul August 9, 2021 05:07 PM UTC

We are able to build and deploy it manually with VS 2019 (Windows) successfully.



GK Gowthamraj Kumar Syncfusion Team August 10, 2021 01:19 PM UTC

Hi Paul, 
 
We suspect the issue may occurs while build the docker image using YAML script. Kindly check the commands used to build the docker image in YAML script to resolve this issue.  
 
Regards, 
Gowthamraj K 



WB William Boebel August 23, 2021 07:52 PM UTC

Had the exact same scenario, however we are using the Syncfusion.WebKitWrapper instead of Blink.

Either way, Visual Studio publishing the container to the ACR worked fine but the Azure Pipeline did not, giving us a permission error.

We found when inspecting the images, that the /app/QtBinaries/QtBinariesLinux/Syncfusion.WebKitWrapper file would have execute permission on the image created by Visual Studio publish, but it would not have execute permission on the image created by the Azure Pipeline.

Added this near the end of our DOCKERFILE and it started working....

RUN chmod 777 /app/QtBinaries/QtBinariesLinux/Syncfusion.WebKitWrapper

Thought I would share, as it might help to inspect your file permissions on the images that Azure Pipelines generates.




GK Gowthamraj Kumar Syncfusion Team August 24, 2021 11:39 AM UTC

Hi William, 
 
Thank you for the update. Please let us know if you need any other assistance on this.   
 
Regards, 
Gowthamraj K 


Loader.
Up arrow icon