We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Issue with Fonts when converting a pdf document to images with Aspose.Words dll in Rocky Linux Server

Hi Team,

When I convert a document from pdf to png image format by using Aspose.Words dll, the font styles are not getting converted properly and the fonts used on the original document is totally off.

Specifications:
.NET Framework = .NET 6.0
Library = Aspose.Words.dll v.22.6.0
Hosting Server = Rocky Linux

So far, I have tried below options as per the Aspose documentation, but unfortunately nothing worked out.
Reference : https://docs.aspose.com/words/net/how-to-run-aspose-words-in-docker/#configuring-a-dockerfile

  1. Installed “SkiaSharp.NativeAssets.Linux” and also installed libfontconfig1. This option is not working.
  2. Installed “SkiaSharp.NativeAssets.Linux.NoDependencies” and it is also not working.

Could you please suggest how can we resolve this issue as it is a core part of our project development.

Thanks.

@rpostdev Could you please attach your document here for testing. Also, please try using direct conversion form PDF to image:

Aspose.Words.Pdf2Word.FixedFormats.PdfFixedRenderer pdfRenderer = new Aspose.Words.Pdf2Word.FixedFormats.PdfFixedRenderer();
using (FileStream pdfStream = File.OpenRead(@"C:\Temp\in.pdf"))
{
    IReadOnlyList<Stream> images = pdfRenderer.SavePdfAsImages(pdfStream);
    for (int frameIdx = 0; frameIdx < images.Count; frameIdx++)
    {
        using (Stream imgStream = images[frameIdx])
        using (FileStream imgFile = File.Create(string.Format(@"C:\Temp\out_{0}.png", frameIdx)))
        {
            imgStream.CopyTo(imgFile);
        }
    }
}

While loading PDF document into Document object, Aspose.Words converts Fixed Page Document structure into the Flow Document Object Model. Unfortunately, such conversion does not guaranty 100% fidelity. The above method of conversion avoids conversion from Fixed Page Document structure into the Flow Document Object Model and Fixed Page PDF is directly converted to image.

@alexey.noskov
Please find the attached document for your testing purpose.
Calibration doc.pdf (92.6 KB)

Also, thanks for your suggestion. We will try and keep you updated with the status.

@rpostdev I have checked with the direct conversion from PDF to PNG and see the difference in fonts on Linux. I have logged the problem as WORDSNET-24757. We will investigate the issue and let you know one it is resolved or we have more information for you.

@alexey.noskov Could you please share any update on this ticket.
Please let us know if you can provide a separate Dll with this fix.

@rpostdev Unfortunately, there are no news regarding the issue yet. It is currently in the queue for analysis. We will be sure to keep you updated and let you know once the issue is resolved or we have more information for you.