I am using https://help.syncfusion.com/file-formats/pdf/working-with-barcode#set-location-and-size-to-the-barcode to generate a QR code. I am however getting an error when generating the QR code image on my docker image. Does the ASP.Net Core PDF component have a dependency on other libraries for it to work?
What am I missing?
StackTrace:
2022-01-03 05:31:14.753 +00:00 [ERR] System.TypeInitializationException: The type initializer for 'Gdip' threw an exception.
---> System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory
at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output)
at System.Drawing.SafeNativeMethods.Gdip..cctor()
--- End of inner exception stack trace ---
at System.Drawing.SafeNativeMethods.Gdip.GdipCreateBitmapFromScan0(Int32 width, Int32 height, Int32 stride, Int32 format, IntPtr scan0, IntPtr& bitmap)
at Syncfusion.Pdf.Barcode.PdfQRBarcodeHelper.ToImage(SizeF size)
at Syncfusion.Pdf.Graphics.PdfBarcodeExtension.ToImage(PdfBidimensionalBarcode barcode, SizeF size)
at InstaTranscribeServerSide.Pages.GenerateQRCode.UpdateQRCodeComponent.UploadFiles_Success(SuccessEventArgs args) in C:\t\InstaTranscribeServerSide-PurposeUI\InstaTranscribeServerSide\Pages\GenerateQRCode\UpdateQRCode.razor.cs:line 76
source code:
var pdfQRBarcode = new PdfQRBarcode
{
ErrorCorrectionLevel = PdfErrorCorrectionLevel.Medium,
XDimension = 3,
Text = uploadedS3FilePath
};
var barcodeImage = pdfQRBarcode.ToImage(new System.Drawing.SizeF(300, 300));
var memoryStream = new MemoryStream();
barcodeImage.Save(memoryStream, ImageFormat.Jpeg);
memoryStream.Position = 0;
Dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
#For InstaTranscribe
RUN apt-get -y update && apt-get -y upgrade && apt-get install -y ffmpeg
#For URLOrTextToPDF: WebKit Rendering
RUN apt-get update --yes && apt-get install xvfb --yes && apt-get install libssl1.1 --yes && apt-get install libx11-dev libx11-xcb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-shm0-dev libxcb-util0-dev libxcb-xfixes0-dev libxcb-xkb-dev libxcb1-dev libxfixes-dev libxrandr-dev libxrender-dev --yes
#For URLOrTextToPDF: Blink Rendering
RUN apt-get install 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 --yes
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["InstaTranscribeServerSide/InstaTranscribeServerSide.csproj", "InstaTranscribeServerSide/"]
COPY ["Services/Services.csproj", "Services/"]
COPY ["DataAccess/DataAccess.csproj", "DataAccess/"]
RUN dotnet restore "InstaTranscribeServerSide/InstaTranscribeServerSide.csproj"
COPY . .
WORKDIR "/src/InstaTranscribeServerSide"
RUN dotnet build "InstaTranscribeServerSide.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "InstaTranscribeServerSide.csproj" -c Release -o /app/publish
FROM base AS final
VOLUME CREATE uploadedfiles
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "InstaTranscribeServerSide.dll"]
Once the change has been implemented, would you have a beta release so syncfusion customers get access to it faster?
Also does the library work on linux if we use .Net 5.0?
|
Once the change has been implemented, would you have a beta release so syncfusion customers get access to it faster?
|
Yes. We will notify you with release version, once this support is included in our Volume release.
You can track the status of the implementation in the below feedback.
| |
|
Also does the library work on linux if we use .Net 5.0?
|
Yes. We can convert the Barcode to Image using Net 5.0 in Linux docker with help of our PDF library. We have created a simple docker 5.0 sample to convert Barcode to Image with required prerequisites packages. We have attached the sample and output image for your reference. Please try the below sample on your end and let us know the result.
Docker file:
|