diff --git a/File-Formats/PDF/Convert-HTML-To-PDF/htmlconversion_images/Failedtolaunchchromium.png b/File-Formats/PDF/Convert-HTML-To-PDF/htmlconversion_images/Failedtolaunchchromium.png new file mode 100644 index 000000000..3f0d1e1d3 Binary files /dev/null and b/File-Formats/PDF/Convert-HTML-To-PDF/htmlconversion_images/Failedtolaunchchromium.png differ diff --git a/File-Formats/PDF/Convert-HTML-To-PDF/htmlconversion_images/dependencies.png b/File-Formats/PDF/Convert-HTML-To-PDF/htmlconversion_images/dependencies.png new file mode 100644 index 000000000..f4a476e36 Binary files /dev/null and b/File-Formats/PDF/Convert-HTML-To-PDF/htmlconversion_images/dependencies.png differ diff --git a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md index fd2bcbfeb..840da9246 100644 --- a/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md +++ b/File-Formats/PDF/Convert-HTML-To-PDF/troubleshooting.md @@ -731,4 +731,92 @@ You can downloaded a complete working sample from [GitHub](https://github.com/Sy {% endhighlight %} -{% endtabs %} \ No newline at end of file +{% endtabs %} + +## Failed to launch chromium: Missing required dependent packages issue occurs in Azure function Linux with premium plans. + + + + + + + + + + + + + +
ExceptionFailed to launch chromium: Missing required dependent packages issue occurs in Azure function Linux with premium plans. +
Reason +The reported issue occurs due to missing of required Linux dependencies in Azure function to perform the conversion in premium plans (such as Ep1) +
Solution +To overcome this issue by installing the Linux dependencies package in SSH window. Please refer the below commands and screenshot, + +{% tabs %} + +{% highlight C# %} + +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 +{% endhighlight %} + +{% endtabs %} +

+Please refer to the below screenshot, +

+ +
+

+(Or) +

+We can install the required dependencies using the dependencies vis shell script. Please find the below. +

+
+

+code snippet: +

+{% tabs %} +{% highlight C# %} + + private static void InstallLinuxPackages(FileInfo functionAppDirectory) + { + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + return; + } + FileAccessPermissions ExecutableFilePermissions = FileAccessPermissions.UserRead | FileAccessPermissions.UserWrite | FileAccessPermissions.UserExecute | + FileAccessPermissions.GroupRead | FileAccessPermissions.GroupExecute | FileAccessPermissions.OtherRead | FileAccessPermissions.OtherExecute; + //Install the dependencies packages for HTML to PDF conversion in Linux + string shellFilePath = Path.Combine(functionAppDirectory.Directory.Parent.FullName, @"wwwroot/data"); + string tempBlinkDir = Path.GetTempPath(); + string dependenciesPath = Path.Combine(tempBlinkDir, "dependenciesInstall.sh"); + if (!File.Exists(dependenciesPath)) + { + CopyFilesRecursively(shellFilePath, tempBlinkDir); + var execPath = Path.Combine(tempBlinkDir, "dependenciesInstall.sh"); + if (File.Exists(execPath)) + { + var code = Function1.Chmod(execPath, ExecutableFilePermissions); + if (code != 0) + { + throw new Exception("Chmod operation failed"); + } + } + Process process = new Process + { + StartInfo = new ProcessStartInfo + { + FileName = "/bin/bash", + Arguments = "-c " + execPath, + CreateNoWindow = true, + UseShellExecute = false, + } + }; + process.Start(); + process.WaitForExit(); + } + } + +{% endhighlight %} +{% endtabs %} +
\ No newline at end of file