An image becoming all white and text corruption in some images

Hello Aspose,

I am trying to convert ms Excel files to PDF on the environment Docker + Linux (Ubuntu 18.04.5 LTS).
Among the outputs, I can find at least one image in which text corruption arises.
Besides, I can find an image which has become all white.
Could you please teach me how to resolve these phenomena?
I put the script which I wrote below.
As for the input file, it takes much time to prepare for you because of a certain reason.

String filepath = args[0];
String filename = Path.GetFileName(args[0]);

// Make directories
Directory.CreateDirectory(args[1] + "/" + filename);

String txt_outpath = args[1] + "/" + filename + "/" + "txt";
String pdf_outpath = args[1] + "/" + filename + "/" + "pdf";
Directory.CreateDirectory(txt_outpath);
Directory.CreateDirectory(pdf_outpath);

// Open an Excel file
Workbook workbook = new Workbook(filepath);

// Set Fonts folder
Aspose.Cells.FontConfigs.SetFontFolder("../data/Fonts", false);                     

// Save the entire file as PDF 
workbook.Save(args[1] + "/" + filename +"/"+ "result.pdf", Aspose.Cells.SaveFormat.Pdf);           

for (int j = 0; j < workbook.Worksheets.Count; j++)
{
    Worksheet ws = workbook.Worksheets[j];

    // Save each sheet as PDF
    workbook.Save(pdf_outpath +"/"+ ws.Name + ".pdf", Aspose.Cells.SaveFormat.Pdf);

    //Text save options
    TxtSaveOptions opts = new TxtSaveOptions();
    opts.Separator = Convert.ToChar(" ");
    workbook.Save(txt_outpath +"/"+ ws.Name + ".txt", opts);

    if (j < workbook.Worksheets.Count - 1)
    {
        workbook.Worksheets[j + 1].IsVisible = true;
        workbook.Worksheets[j].IsVisible = false;
    }
}

@shun1985,

First, please move the above line of code at the start and especially before initializing Workbook and try if it makes any difference.

If you still find the issue, kindly do provide your template Excel file, we need to test your issue on our end. We will do it soon.

@Amjad_Sahi

I’m Sorry for late reply.
Because moving the line at the start of the code didn’t make a difference,
so I copied and pasted all the Windows’ fonts file into the default fonts folder of Linux.

Here are template source Excel file and two converted outputs.
One of the outputs was generated on docker + Linux environment (target),
and the other was generated on Windows. This is for use of comparison.
source.zip (37.8 KB)
result_docker+linux.pdf (103.1 KB)
result_windows.pdf (53.7 KB)

Now the situations are as below.

  1. One image becomes all white (this is a Bitmap Image Object in the original Excel file) (page1)
  2. Characters in an image are partly cutted off and seems mal-positioned (page1).
  3. Characters in Shape objects overlaps in greater degrees. (page3)

I’m always admired with your company’s dedication to offer great services.

@shun1985,

Thanks for the template file and output PDF files.

We noticed your mentioned issue is there on docker + linux environment, it looks ok in Windows environment though. We have logged an investigation ticket with an id “CELLSNET-47618” for your issue. The issue is logged as following:
CELLSNET-47618 - An image (embedded) becomes all white and some text corruption in other images/shapes in Excel to PDF rendering

Once we have an update on it, we will let you know.

@Amjad_Sahi

Yes, it’s ok in Windows environment.
I appreciate your ongoing investigation.
Thanks always.

@shun1985,
You are welcome.

@shun1985,

We are pleased to update you that 1) and 2) are fixed. We are currently working over 3) and hopefully it will be fixed soon. Once all your issues are resolved, we will share a fix with you.

@Amjad_Sahi

Thanks for a good news !
I’m looking forward to your report that the 3rd has been fixed.

@shun1985,
You are welcome.
We will let you know about any update soon.

@ahsaniqbalsidiqui

Thank you for your continuous dedication,

I just want to confirm whether the fixes 1) and 2) are already reflected to the software.
I reinstalled Aspose.Cells and in the way of testing.
Or, after completing all the fixes, will they be reflected ?

@shun1985,
We are gathering information about it and will share our feedback soon.

@shun1985,

For problem 1 and 2, please try Aspose.Cells20.9.8 For .NetStandard20 (attached), this fix resolves these issues.
Aspose.Cells20.9.8 For .Net2_AuthenticodeSigned.Zip (5.4 MB)
Aspose.Cells20.9.8 For .Net4.0.Zip (5.4 MB)
Aspose.Cells20.9.8 For .NetStandard20.Zip (5.4 MB)

For problem 3, because System.Drawing.Common does not draw very precisely in linux, we still need more time to revise it. Once we figure it out, we will provide a new fix for it.

@Amjad_Sahi

Thank you for the files and I’m sorry for late reply.
I’d like to know how to use “Aspose.Cells.xml” in each zip file,
in order for the two fixes to be reflected.

@shun1985,

You do not need to use it, it is automatically used when you add reference to Aspose.Cells.Dll in VS.NET.

Please note, Aspose.Cells.xml file is an API Reference documentation for developers who are working in Visual Studio. It lists out description for class names, methods and their parameters, etc. When you deploy your application/solution, you may skip this file if you want.

@Amjad_Sahi

Thank you for giving me information kindly. Many thanks as always.

After adding reference to Aspose.Cells.Dll (Aspose.Cells20.9.8 For .NetStandard20),
I do confirm that problem 2 has been fixed but observe problem 1 persists.
Maybe a certain requirement is lacking ?

@shun1985,

Which issue you are talking about?
As we told you, for problem 3, because System.Drawing.Common does not draw very precisely in linux, we still need more time to revise it. This issue is not fixed while other two following issues are fixed.

  1. One image becomes all white (this is a Bitmap Image Object in the original Excel file) (page1)
  2. Characters in an image are partly cutted off and seems mal-positioned (page1)

@Amjad_Sahi

I’m talking about this one.

  1. One image becomes all white (this is a Bitmap Image Object in the original Excel file) (page1)

@shun1985,

I tested your scenario/case using the following sample code on a Windows console . NET Core application, it works fine and first two issues are resolved:
e.g
Sample code:

Workbook workbook = new Workbook("f:\\test1\\source\\source_template.xlsx");
// Save the entire file as PDF 
workbook.Save("f:\\test1\\source\\result1.pdf", Aspose.Cells.SaveFormat.Pdf);

Please find attached the output PDF file for your reference.
result1.pdf (84.5 KB)

Could you give your output PDF with environment details, we will check it soon.

@Amjad_Sahi

Here is an attached pdf file that my .NET Core application has outputted.
In this output, the issue #1 isn’t resolved (One image becomes all white).
My environment is docker + Linux.
result_env_docker+linux.pdf (108.0 KB)

@shun1985,
I have tried this scenario using docker image but afraid to share that still not able to reproduce it. However I have logged your concern with the ticket for our reference. We will write back here once any upate is ready for sharing.