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

Free Support Forum - aspose.com

Converting office files to PDF files

I’m using Aspose Total license for converting office files to PDF and everything is running fine in windows. But when I deploy it into a linux container then files are not getting converted correctly (logos are missing from files). Also office 97-2003 versions are throwing error in linux. All doc,xls,ppt etc. are failing. Please help me with the packages that need to be installed in linux machine. Currently I’m using following in my docker file:

RUN apk --update add libgdiplus --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ --allow-untrusted &&
apk --update add libc-dev &&
apk --update add terminus-font &&
apk --update add --no-cache icu-libs &&
apk --no-cache add msttcorefonts-installer fontconfig &&
update-ms-fonts &&
fc-cache -f

Thank you for your query.

Could you please share the sample Office files along with the issue detail by providing images etc. for our analysis? We will try to reproduce the issue here and provide assistance accordingly. Please ensure that that you are using latest version of each Aspose product before sharing the information as we do not provide fixes for older versions.


I’m attaching a zip file containing following sample files and error messages:

  1. Docx - File got converted but logos and images were missing from the converted files.
  2. Doc - File did not get converted. Refere to file “testdocerror” for the error that has been thrown.
  3. Xlsx - File got converted with logo. So no issue here.
  4. Xls - File not converted. Refer to “testxls1error”.
  5. PPT/PPTX - Both got converted correctly.
  6. Email - File converted. But missing image and logos. This happens in windows as well.AsposeIssues.zip (2.2 MB)

Docker file content I’ve already provided in my previous comment. Please refer to that for the packages I’m installing into the linux container.


We are testing the scenario and will get back to you shortly.


We have tested the scenario in our environment using latest version of the API and found no issue. For your kind reference, output files are also attached.
PDF files.zip (786.9 KB)

We have tried to test your scenario in Linux Container (Ubuntu 18.04.2 LTS) using following steps to avoid the issue that you were facing:

  • The docker we used was: microsoft/dotnet, install it first:
    sudo docker pull microsoft/dotnet
  • Then we installed libgdiplus:
    apt-get update
    apt-get install -y libgdiplus
    cd /usr/lib && ln -s libgdiplus.so gdiplus.dll
  • And installed libc6-dev:
    apt-get install -y --no-install-recommends libc6-dev

As you have already stated that presentations rendered correctly. We have verified the same in the shared package too.

For this point, we have generated the MHTML using Aspose,Email and it has not missing logo. Would you kindly export to MHTML and convert it into PDF using Aspose.Words. In case you face any issue, please feel free to let us know.

Doc/Docx - “We have tested the scenario in our environment using latest version of the API and found no issue. For your kind reference, output files are also attached.” - Have you tested it in Linux environment? I’m using Ubuntu 16.04. Is it compatible with that?

xls - Will it run in Linux 16.04?

Email - I’m using latest version od Aspose.Email and Aspose.Word. Using following code:

public async Task ConvertFileToPdfAsync(string filePath)
string str = filePath + “.pdf”;
MailMessage message = MailMessage.Load(filePath);
message.TimeZoneOffset = TimeZone.CurrentTimeZone.GetUtcOffset(message.Date);
MhtSaveOptions mhtSaveOptions = new MhtSaveOptions
MhtFormatOptions = MhtFormatOptions.WriteHeader | MhtFormatOptions.WriteCompleteEmailAddress
mhtSaveOptions.SkipInlineImages = false;
MemoryStream msgStream = new MemoryStream();
message.Save(msgStream, mhtSaveOptions);
msgStream.Position = 0;
var options = new Aspose.Words.LoadOptions()
LoadFormat = LoadFormat.Mhtml
var document = new Document(msgStream, options);
document.Save(str, SaveFormat.Pdf);
return str;
catch (Exception ex)
return ex.Message;

Anything wrong with it? Please share your converted email file with me.


We are testing the scenario and will get back to you shortly.


Please note that Aspose.Words mimics the behavior of MS Word. You are facing this issue because the page width of MHTML (imported into Aspose.Words’ DOM) is greater than the default page width. To get the desired output, please increase the page’s width of document.

Please check the following code example. Hope this helps you.

Document doc = new Document(MyDir + "input.mhtml");
doc.FirstSection.PageSetup.PageWidth = 900;
doc.FirstSection.PageSetup.LeftMargin = 50;
doc.Save(MyDir + "20.1.pdf");

Thanks. It works.