Pdf to Html conversion using Aspose.Pdf (20.9) is not working in Docker

I am trying to convert pdf file into html using the following code. (Using 20.9 version of the Aspose.Pdf)

var doc = new Document(pdfFile);
var htmlSaveOptions = new HtmlSaveOptions(HtmlDocumentType.Html5, true);
doc.Save(htmlFileName, htmlSaveOptions);
doc.Dispose();

This code is working fine in my windows dev machine. But Getting the following exception in Docker (Linux) environment.

Object reference not set to an instance of an object.
at #=z2iXbQf_DLi_sOyNgiwKRotXJnOmMuXOibrsGFe9SBb6t.#=z5F8dwV3wjal1()
at #=z3ZQvZYuLvdVcKUYIa0iHLMM9TV$uRvvRs9gagKurIhWCk9AlXQ==.#=z8wHZNJg=(#=zIiLJFlmpyWhFpRxTGDlVzgjD$q0YZ_iIoFA_ygw1OswO #=zncHgIAs=, #=zQCcci$P9KO6aruY_AVdW2nrjyVMLg5PwHLw9fIMNgIAV #=z9f9HnpRut1ry, #=zCZLbAz4eJyV9yCi8x_VqXGnthY1sAPWj0A== #=zCaaR73c=)
at #=zmcmFK44ua_78K0uhsdt3OrZnlkVpqBmnQssWdSWXAbF7GDr2Ow==.#=z8wHZNJg=(#=zIiLJFlmpyWhFpRxTGDlVzgjD$q0YZ_iIoFA_ygw1OswO #=zncHgIAs=, #=zQCcci$P9KO6aruY_AVdW2nrjyVMLg5PwHLw9fIMNgIAV #=z9f9HnpRut1ry)
at #=zwN1txnOOJHB7TPns3RMsj7rj08DD1IeGru7ntvqdvih6.#=zO4UfQtRcCNO8BFXQow==(#=zIiLJFlmpyWhFpRxTGDlVzgjD$q0YZ_iIoFA_ygw1OswO #=zncHgIAs=, List1 #=z_$qOl6o=) at #=zwN1txnOOJHB7TPns3RMsj7rj08DD1IeGru7ntvqdvih6.#=z3N2ifyXwf1JC1h0nJg==(#=zIiLJFlmpyWhFpRxTGDlVzgjD$q0YZ_iIoFA_ygw1OswO #=zncHgIAs=, List1 #=z_$qOl6o=)
at #=zwN1txnOOJHB7TPns3RMsj7rj08DD1IeGru7ntvqdvih6.#=z284JtuCJ$ZF_(#=zIiLJFlmpyWhFpRxTGDlVzgjD$q0YZ_iIoFA_ygw1OswO #=zncHgIAs=, List1 #=zI7LPANo2M1l1) at #=zwN1txnOOJHB7TPns3RMsj7rj08DD1IeGru7ntvqdvih6.#=zuSV6htM=(#=zoz8MsmekrKYzbYnyR$3IAuTlGyIr #=zL3w1SIw=, #=zHSCBrEm4MU2lcr3JXjwt5lgLDG3mFcQOXg== #=zL9Fw8jc=, #=zIiLJFlmpyWhFpRxTGDlVzgjD$q0YZ_iIoFA_ygw1OswO #=zncHgIAs=) at #=zIDJ8lJkKTFjD$aoGq_PniGv21ucIN4C0Kg==.#=zCL1w3V4=(Int32 #=zyUBcjts=, IList1 #=zgMejJPxYbdkaju5RqQ==, #=zyTmgWNGJkQg5 #=z9bYziYo=)
at #=zIDJ8lJkKTFjD$aoGq_PniGv21ucIN4C0Kg==.#=zuSV6htM=()
at #=z6Y2y5E4BS36T27DL4LAHa78m1t0V.#=zVJQdcedhoM1E(Document #=zL3w1SIw=, #=zIiLJFlmpyWhFpRxTGDlVzgjD$q0YZ_iIoFA_ygw1OswO& #=zwLxD9oqobyiA4dL8DQ==, UnifiedSaveOptions #=zqYjhfuo=, Int32& #=zLNkzdKJcQM1C, Boolean #=zyrQaPXg=)
at #=zXqYM3qbi8r6F$mwgO_FG8KU=.#=zBbVc6Rg=(Document #=zL3w1SIw=, String #=zqNh3uBCG980PujWPgQ==, Stream #=z3atXj8LKS$HC, HtmlSaveOptions #=zqYjhfuo=)
at Aspose.Pdf.Document.#=zHKQ5GIkuJjPT(String #=zapwSpdUjRueB, SaveOptions #=zqYjhfuo=)
at Aspose.Pdf.Document.Save(String outputFileName, SaveOptions options)

Any idea how to solve this issue?

@nazmul.haque

Would you please make sure that following packages are installed in the system where you are performing the conversion:

  • libgdiplus (updated to latest version)
  • msttcorefonts (all windows essential core fonts)

In case issue still persists, please share your sample PDF document with us. We will test the scenario in our environment and address it accordingly.

@asad.ali Thanks for the reply.

msttcorefonts package was not installed, we installed it manually. But still not working.

Here is package details

Package: libgdiplus
Version: 4.2-2

Package: ttf-mscorefonts-installer
Version: 3.7

Please find the attached sample file
BalanceSheet.pdf (11.8 KB)

@nazmul.haque

We were able to replicate the issue in CentOS 7 x64 environment at our side and have logged it as PDFNET-48900 in our issue management system. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We apologize for the inconvenience.

@asad.ali Thanks a lot. Will wait for the fix.

1 Like