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

Free Support Forum - aspose.com

Japanese characters are not getting converted when converting excel to PDF on Unix

We are facing issue in converting Excel to PDF having Japanese characters on Unix. However it works correctly on Windows.

Attaching the source excel file and output PDF file.

Thanks and Regards

Tauqeer Phoplunkar

Nomura India Services Pvt Ltd.

Hi Tauqeer,


Thank you for sharing the samples.

I have checked the sample spreadsheet & its resultant PDF, and I believe the problem is caused due to the unavailability of the required font (MS Gothic) on the machine where conversion operation has to run. Please note, Aspose.Cells APIs require the font used in the spreadsheet to be available in the environment otherwise, it will either substitute the font or do not render it. Please review the following articles for your reference.

Thanks for your quick response. Let me try again after installing the required fonts on Unix.

Thanks

Hi Tauqeer,


In case you do not get your desired results even after installing/placing the fonts and pointing the API to use those fonts then please try the scenario against the latest version 8.6.0 because you are currently using 8.4.2.

Please feel free to get in touch if you face any difficulty.

Hi Babar,

After setting the fonts directory as system property its working fine. But for few Japanese characters conversion is still not working on both windows as well as Unix.

Japanese chars in cell A9() and B12 of attached excel are still not getting converted into PDF. However all other Japanese characters are getting converted.

We are getting error while opening the PDF :

There was an error processing a page. There was a problem reading this document (135) .

If we clear cell A9 and B12 conversion works correctly. I have even tried this using latest Aspose API.

Thanks and Regards

Tauqeer Phoplunkar

Hi Tauqeer,


I have checked your provided spreadsheet, and have noticed that cells A9 & B12 are using Ariel font that is available by default on Windows and can be installed on Linux using the MSTTCORE font package. I have also checked the conversion process on Windows as well as Linux and was not able to notice the problem of incorrect character rendering or any error message while opening the resultant PDF files in Adobe Acrobat Reader. I would request you to please provide the two PDF files one from each platform generated against latest version of Aspose.Cells for Java 8.6.0 for further investigation.
tauqeer.phoplunkar:

After setting the fonts directory as system property its working fine. But for few Japanese characters conversion is still not working on both windows as well as Unix.

I believe the incorrect rendering of a few Japanese characters could be due to the reason that you are setting the font directory using the statement at the bottom of this post. In this case, you are actually restricting the Aspose.Cells for Java API to look for the fonts in the specified directory only while skipping all standard directories that could also hold the font files. The impact of these settings are that the API will not look further for the fonts on other directory and tries to render all the glyph using the available fonts (in specified directory). Could you please change the font loading mechanism to use CellsHelper.setFontDir(s) method at the start of your application and give the scenario another try.

Java

System.setProperty("Aspose.Cells.FontDirExc", "FontDirSet");

I am attaching both the files generated on WIndows and Unix. On both the Systems I am getting this error if Cell A9 and B12 has that Japanese text.

On windows I also tried generating PDF after removing the Font directory system properties but still getting the same error. I have also tried CellHelper.setFontDirs(list) method. But this is not at all working.

If I change the font from ARIAL to MS Gothic then it works.

Hi Tauqeer,


First of all, let us discuss the issue related to the error “There was an error processing a page. There was a problem reading this document (135) .” in another thread for better visibility and tracking. As we are yet not able to replicate this problem, we request you to provide your Windows environment details (as your recently provided sample WindowsPDF,pdf shows this problem) along with input spreadsheet in a new thread for replicating the issue. Please note, we need the following information.

  • Operating system version & architecture
  • JDK type & version
  • Complete/executable source code
  • Input spreadsheet
  • Locale of the machine
  • JVM arguments being set for the process/program

Regarding the problem related to the Japanese characters, I believe we are operating on two different spreadsheets. Please check the attached snapshot, that clearly suggests the same, that is; you are using some other spreadsheet for your testing whereas the previously shared spreadsheet does not correspond to the PDF (UnixPDF) shared in your recent response. Could you please check this on your side and share the same spreadsheet that you are using for testing on your side?

That said, in Windows environment you seldom need to set the font directory as the API scans the C:/Windows/Fonts for all available font files by default, and this is the only directory where installed fonts could be found. Whereas on non-Windows platforms such as Unix/Linux the API scans the directories such as /usr/share/fonts & /usr/local/share/fonts, however, the font files can also be found on different locations. That is the reason, we suggest the users to place the fonts in only one directory (for simplicity) and direct the API to pick those fonts using the CellsHelper.setFontDir at very start of the application, that is; before initializing any of the Aspose.Cells for Java objects. Therefore, in order to troubleshoot this scenario further, please copy the fonts from your Windows environment to Unix and point the CellsHelper.setFontDir method to the location containing TTF files and re-run the conversion process. Furthermore, Aspose.Cells APIs provide the callback functionality to get warnings in case font substitution has occurred during the conversion process. You can use the same in your application to get a better picture of what is going on behind the scene. Please note, if the environment has the exact fonts (used in the spreadsheet) then there will be no warnings.

Hope this helps a bit.

Japanese characters problem is already resolved by copying fonts from windows and setting System property.

-DAspose.Cells.FontDirExc=$HOME/Fonts

Lets discuss other issue in separate thread.

Thanks

Tauqeer

Hi Tauqeer,


Thank you for the confirmation on issue related to the fonts. Please create a new thread with requested information for the problem of corrupted PDF generation. We will analyze that scenario at earliest possible.