Free Support Forum - aspose.com

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.