Hello Everyone,
Using Aspose.PDF.Drawing Version :23.8.0 I am trying to convert html to pdf it is working fine in windows but failing on Openshift platform container which used docker file.
Exception
System.NullReferenceException: Object reference not set to an instance of an object.
at #=z_lz6L7NwOC5$Opx0sV4Vy3fCHdV1.#=z_xlL_4g=(#=z$g1_1cd9cf7aX$Ky1nGNFnnSq6Y$ #=z8LKyoXef$KaP)
at #=znjCIAq_lEhpFMxkItg0Hoj0=.#=zzC6KHTs=(#=z$g1_1cd9cf7aX$Ky1nGNFnnSq6Y$ #=z8LKyoXef$KaP)
at #=zC6nyPlKFSUNCAHcjJkI7tco=.#=zzC6KHTs=(#=z$g1_1cd9cf7aX$Ky1nGNFnnSq6Y$ #=z8LKyoXef$KaP)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zfKRHIbnaykQefbj30UaUESY=(Object #=zV9pIpFA=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zEiqCRvD4KW7NTATRJgA1jfckZ8l6avcciw4$QS0=(MethodBase #=zV9pIpFA=, Boolean #=zG4Yj2og=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=z0nZ5fd$$tCAO14p65xefUAVLdFuWdvLBbdK_lh0=(#=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E= #=zV9pIpFA=, #=qiVRe2Xa2093ghGq$peqzOut$cAfQsK$5lUd$GtWi3pA= #=zG4Yj2og=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zL_dmGTtXqhSKuOMHdPw_o0dg4GHnxAAQM3XM02SPM1gL()
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zWjJR2zGAoVEZBe7saPPO_OyZDtbG(Boolean #=zV9pIpFA=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUw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=zV9pIpFA=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zVWIwfaR4VzLWNJqXf4ZdtFc=(Object[] #=zV9pIpFA=, Type[] #=zG4Yj2og=, Type[] #=zjVnJPMI=, Object[] #=z7Fbm0Bg=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zyNedccThP2nGDym$KBDE$Np3VXPaGJD_Sw==(Stream #=zV9pIpFA=, String #=zG4Yj2og=, Object[] #=zjVnJPMI=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zt4TnogT_5MCffwjoZkxBkuY3Aq0dgXAHfg==(Stream #=zV9pIpFA=, String #=zG4Yj2og=, Object[] #=zjVnJPMI=)
at Aspose.Pdf.Document.#=zfKd3pTjKz7vg(Stream #=zYASsvb0=, SaveOptions #=zY_pfyyzZea2p)
at Aspose.Pdf.Document.#=zsLCngoUWsM$Z(Stream #=zBByd05FRK$s$, SaveOptions #=zmBTYn3Y=)
at Aspose.Pdf.Document.Save(Stream outputStream, SaveOptions options)
at Fos.CommOrch.HtmlToPdfConverter.Business.HtmlToPdfConverterBusiness.ConvertHtmlToPdf() in /home/jenkins/workspace/ration-api_feature_AsposeLibrary/src/Fos.CommOrch.HtmlToPdfConverterBusiness/HtmlToPdfConverterBusiness.cs:line 88
at #=z_lz6L7NwOC5$Opx0sV4Vy3fCHdV1.#=z_xlL_4g=(#=z$g1_1cd9cf7aX$Ky1nGNFnnSq6Y$ #=z8LKyoXef$KaP)
at #=znjCIAq_lEhpFMxkItg0Hoj0=.#=zzC6KHTs=(#=z$g1_1cd9cf7aX$Ky1nGNFnnSq6Y$ #=z8LKyoXef$KaP)
at #=zC6nyPlKFSUNCAHcjJkI7tco=.#=zzC6KHTs=(#=z$g1_1cd9cf7aX$Ky1nGNFnnSq6Y$ #=z8LKyoXef$KaP)
at #=qVNe8kjLFVRnQPtfm6L_HEq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TtXqhSKuOMHdPw_o0dg4GHnxAAQM3XM02SPM1gL()
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zWjJR2zGAoVEZBe7saPPO_OyZDtbG(Boolean #=zV9pIpFA=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zfKRHIbnaykQefbj30UaUESY=(Object #=zV9pIpFA=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zkoHzM9Yai6Wr1qnkCPK5OsWK78atO95OkLYw4MZ$BxQ$()
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zlkKm7dWPY1L6y5TSYrL47SoP84t49QQDGg==(Object #=zV9pIpFA=, UInt32 #=zG4Yj2og=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zWjJR2zGAoVEZBe7saPPO_OyZDtbG(Boolean #=zV9pIpFA=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zWjJR2zGAoVEZBe7saPPO_OyZDtbG(Boolean #=zV9pIpFA=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zVWIwfaR4VzLWNJqXf4ZdtFc=(Object[] #=zV9pIpFA=, Type[] #=zG4Yj2og=, Type[] #=zjVnJPMI=, Object[] #=z7Fbm0Bg=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zyNedccThP2nGDym$KBDE$Np3VXPaGJD_Sw==(Stream #=zV9pIpFA=, String #=zG4Yj2og=, Object[] #=zjVnJPMI=)
at #=qVNe8kjLFVRnQPtfm6L_HEqYYjVXNeUwfEJF_ydUWo3E=.#=zt4TnogT_5MCffwjoZkxBkuY3Aq0dgXAHfg==(Stream #=zV9pIpFA=, String #=zG4Yj2og=, Object[] #=zjVnJPMI=)
at Aspose.Pdf.Document.#=zfKd3pTjKz7vg(Stream #=zYASsvb0=, SaveOptions #=zY_pfyyzZea2p)
at Aspose.Pdf.Document.#=zsLCngoUWsM$Z(Stream #=zBByd05FRK$s$, SaveOptions #=zmBTYn3Y=)
at Aspose.Pdf.Document.Save(Stream outputStream, SaveOptions options)
Docker_File.pdf (2.0 KB)
Also Tried below command didn’t work getting build errors
RUN sed -i’.bak’ ‘s/$/ contrib/’ /etc/apt/sources.list
RUN apt-get install -y ttf-mscorefonts-installer fontconfig
RUN apt-get install -y libgdiplus
RUN apt-get install ttf-mscorefonts-installer
Sample Code:
string htmldata = “
Hello world”;
byte[] htmlBytes = Encoding.UTF8.GetBytes(htmldata);
byte[] databyte = null;
Aspose.Pdf.HtmlLoadOptions htmlLO = new Aspose.Pdf.HtmlLoadOptions();
htmlLO.PageInfo.Margin.Left = 10;
htmlLO.PageInfo.Margin.Right = 10;
htmlLO.PageInfo.Margin.Top = 75;
htmlLO.PageInfo.Margin.Bottom = 20;
Aspose.Pdf.Document pdfdoc = null;
using (MemoryStream htmlStream = new MemoryStream(htmlBytes))
pdfdoc = new Aspose.Pdf.Document(htmlStream, htmlLO);
using (MemoryStream emailstream = new MemoryStream())
{
Aspose.Pdf.PdfSaveOptions pdfSO = new Aspose.Pdf.PdfSaveOptions();
pdfdoc.Save(emailstream, pdfSO);
databyte = emailstream.ToArray();
}
System.IO.File.WriteAllBytes( “C:/Samplehtml.pdf”, databyte);
Please help me with docker commands which need to be added to resolve this issue on Linux