Hello,
I have a issue with pdf create function. When I deploy with Visual Studio Publish, pdf create runs successfully on App Service but when I deploy with Azure Devops Pipeline, I got "Failed to convert webpage Failed to convert webpage " error with the same code. How can I resolve the issue ? I cheked previous questions about it but I couldn't find any absolute solution.
Hi Polat,
If you are using Run from package option while deploying the project, the application only has read only permission. But for converting HTML to PDF, we internally launch the browser process from Binaries folder. Due to the read only permission, the converter unable to launch the browser process. The reported issue may occur, we could not convert HTML to PDF with this configurations. So, can you please try the conversion without run from package option while deploying the app to azure app service.
https://docs.microsoft.com/en-us/azure/app-service/deploy-run-package#run-the-package
Please refer to the below links to troubleshooting the WebKit/Blink HTML converter.
WebKit: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit#troubleshooting
Blink: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink#troubleshooting
Please try the above suggestion and let us know the result. If still you are facing an issue, we request to share the complete deploy details with steps to reproduce the issue with simplified sample. So that it will helpful for us.
Regards,
Gowthamraj K
Hello Gowthamraj
Thank you so much for your help I have no options to uncheck "Run from package" because I'm using Azure Devops Pipeline with steps (Without yaml)
First step is dotnet publish, second and third one are docker build and push.
Hi Polat FIRAT,
The reported issue may occurs, if the docker image is not build properly with the pre-requisites and resource shortage. 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 and increase the the storage. Then manually deploy the docker image to Azure app service with Linux docker and update us the details.
WebKit: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit#troubleshooting
Blink: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink#troubleshooting
Please follow the below KB steps to convert html to pdf in Azure App service using the Blink rendering engine with Linux Docker,
If possible, kindly push the docker image to docker hub or share the manual steps to build the docker image, complete code snippet, stack track details. it will be helpful for us to analyse and assist you further on this.
Regards,
Gowthamraj K
Hello,
I updated the docker file, I build on my local VS and push into local Docker but still not working
Docker File is below
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
#required for Syncfusion PDF converter Blink engine in Linux
RUN apt-get update && \
apt-get install -yq --no-install-recommends \
libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
libnss3 libgdiplus
FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["src/Application.Connect/Application.Connect.csproj", "src/Application.Connect/"]
COPY ["src/Application.Services.Integration.Messaging.Pdf/Application.Services.Integration.Messaging.Pdf.csproj", "src/Application.Services.Integration.Messaging.Pdf/"]
COPY ["src/Application.Shared/Application.Shared.csproj", "src/Application.Shared/"]
COPY ["src/Application.Connect.Integration.HostedService/Application.Connect.Integration.HostedService.csproj", "src/Application.Connect.Integration.HostedService/"]
COPY ["src/Application.Services.Data.EntityFramework/Application.Services.Data.EntityFramework.csproj", "src/Application.Services.Data.EntityFramework/"]
COPY ["src/Application.Services.Common/Application.Services.Common.csproj", "src/Application.Services.Common/"]
COPY ["src/Application.IdentityServer.Shared/Application.IdentityServer.Shared.csproj", "src/Application.IdentityServer.Shared/"]
COPY ["src/Application.Services.Data.Common/Application.Services.Data.Common.csproj", "src/Application.Services.Data.Common/"]
COPY ["src/Application.Connect.Integration.Delivery.Pipeline/Application.Connect.Integration.Delivery.Pipeline.csproj", "src/Application.Connect.Integration.Delivery.Pipeline/"]
COPY ["src/Application.Services.CareUpdateService/Application.Services.CareUpdateService.csproj", "src/Application.Services.CareUpdateService/"]
COPY ["src/Application.Connect.Integration.Common/Application.Connect.Integration.Common.csproj", "src/Application.Connect.Integration.Common/"]
COPY ["src/Application.Connect.Integration.Messaging.Hl7v2/Application.Connect.Integration.Messaging.Hl7v2.csproj", "src/Application.Connect.Integration.Messaging.Hl7v2/"]
COPY ["src/Application.Connect.Integration.Delivery.Pipeline.Common/Application.Connect.Integration.Delivery.Pipeline.Common.csproj", "src/Application.Connect.Integration.Delivery.Pipeline.Common/"]
COPY ["src/Application.Connect.Integration.Delivery.Pipeline.Samples/Application.Connect.Integration.Delivery.Pipeline.Samples.csproj", "src/Application.Connect.Integration.Delivery.Pipeline.Samples/"]
RUN dotnet restore "src/Application.Connect/Application.Connect.csproj"
WORKDIR "/src/Application.Connect"
COPY . .
RUN dotnet build "src/Application.Connect/Application.Connect.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "src/Application.Connect/Application.Connect.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Application.Connect.dll"]
Hi Polat,
Thank you for sharing the details.
On analyzing the provided details, we need to additionally install the libgbm1 dependency package to perform HTML to Pdf conversion using the latest blink binaries Linux. Kindly refer to the below code snippet to install the dependency packages.
|
RUN apt-get update && apt-get install -yq --no-install-recommends libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3 libgbm1 |
Please follow the below documentation link,
Pre-requisites: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink#prerequisites-for-linux
UG: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink
Troubleshooting: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink#troubleshooting
KB: https://www.syncfusion.com/kb/11299/how-to-convert-html-to-pdf-using-blink-in-linux-docker
Please make sure the below command line argument are added in your converter setting,
|
//Set command line arguments to run without sandbox. settings.CommandLineArguments.Add("--no-sandbox"); settings.CommandLineArguments.Add("--disable-setuid-sandbox");
|
Please install the above dependency package on your and let us know the result.
Regards,
Gowthamraj K
Hello
Still not working despite no adjustments. You shared an image when I looked at another ticket with the same problem. Would you mind sharing some basic Azure Pipeline YAML?
It appears to be connected to the DotNetPublish step. Because it generates an image on my local drive when I publish using Visual Studio (with pubxml), it works. However, the image produced by Azure Pipeline is not wor.
Hi Polat FIRAT,
Currently, we are checking on this with provided details on our end and we will update the further details on August 3rd 2022.
Regards,
Gowthamraj K
Hi Polat FIRAT,
We are facing difficulties in building and pushing the docker image using steps in the Azure pipeline. Currently, we are working on this and we will update the further details on August 5th, 2022.
Regards,
Sivaram G
Hi Polat FIRAT,
We are facing the complexities in setup the Azure resources for building and pushing the docker image using steps in the Azure pipeline. We are working on this and we will update the further details on August 9th, 2022.
Regards,
Sivaram G
Hi Polat,
On our further validation, we were unable to reproduce the reported issue on our end. We have tested the simple URL to PDF conversion in Linux docker using blink and the conversion works properly when deploying the docker image using the Azure DevOps pipeline on our end. We have build and push the docker image to docker hub container registry and deployed in Azure WebApp. We have attached the Azure hosted link, code snippet, pipeline build, and push steps for your reference,
Hosted link: https://dockerpipelinetest.azurewebsites.net/
Code Snippet: https://www.syncfusion.com/downloads/support/directtrac/general/ze/CodeSnippet-1731912050
Please find the pipeline steps below for build and pushing the docker images to the docker hub container,
|
# Docker # Build a Docker image # https://docs.microsoft.com/azure/devops/pipelines/languages/docker
name: Docker trigger: branches: include: - master paths: include: - Application.Connect/*
pool: vmImage: 'ubuntu-latest'
variables: ImageName: '${dockerid}/application.connect:$(Build.BuildId)'
stages: - stage: Build displayName: Build image jobs: - job: Build displayName: Build and push Docker image steps: - task: Docker@1 displayName: 'Build the Docker image' inputs: containerregistrytype: 'Container Registry' dockerRegistryEndpoint: 'dockerhub' command: 'Build an image' dockerFile: '**/Dockerfile' imageName: '$(ImageName)' includeLatestTag: true useDefaultContext: false buildContext: '.'
- task: Docker@1 displayName: 'Push the Docker image to Dockerhub' inputs: containerregistrytype: 'Container Registry' dockerRegistryEndpoint: 'dockerhub' command: 'Push an image' imageName: '$(ImageName)' condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
|
Please try the provided code snippet and pipeline steps on your end and let us know the result
Regards,
Sivaram G