Export to pdf not showing correctly

I use the following code to export 1.xlsx to pdf:



Workbook workbook = new Workbook(sourcePath);



PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();

pdfSaveOptions.setAllColumnsInOnePagePerSheet(true);

workbook.save(targetPath, pdfSaveOptions);



But the text boxes on the right do not showing correctly. The texts are cut off.



And even more, aaa.xlsx shows totally wrong, no pictures are shown.



1.xlsx is created and modified by windows office.

aaa.xlsx is modified in wps

Hi Huangfu,


Thank you for contacting Aspose support.

We have evaluated your presented scenarios while using the latest version of Aspose.Cells for Java 8.4.1.2, and we are able to replicate both mentioned issues. We have logged appropriate tickets with following details.

  • CELLSJAVA-41308: Shapes in spreadsheet 1.xlsx have rendered incorrectly. They seem to have moved a little on right due to which they are getting truncated.
  • CELLSJAVA-41309: Shapes in the spreadsheet aaa.xlsx do not render on resultant PDF.

Please spare us little time to properly analyze these incidents, and to provide the fix. In the meanwhile, we will keep you posted with updates in this regard.

Hi,

Thanks for using Aspose.Cells for Java.

We have fixed the issue.

  • CELLSJAVA-41308 - Shape location is wrong while rendering spreadsheet to PDF format

Please download and try this fix: Aspose.Cells for Java v8.4.1.5 and let us know your feedback.

Sorry, it’s still not correct

In ms excel, it’s looks as 1.png
But in the exported pdf, it’s looks as 2.png

The characters exceed the text box

Hi Huangfu,


We are sorry to know that you still experiencing problem that we are unable to replicate on our side. Please check the attached PDF that we have generated against the sample 1.xlsx while using the latest version of Aspose.Cells for Java 8.4.1.5. You may observe that the text isn’t exceeding the box limits in this file. In order to investigate the matter further, we request you to please provide us the PDF generated on your end.

Please also provide environment details where conversion is taking place. Please note, we are interested in the following information.

  • Operating System version
  • Operating System architecture
  • JDK type
  • JDK version

On linux with jdk 1.7.0_60-b19, it works perfect.
But on Mac 10.10.3 (14D136) with java 1.8.0_11 and 1.7.0_75, it runs both as I reported.

Hi again,


Thank you for the further details.

We suspect that you are missing a few fonts in your MacOS environment due to which Aspose.Cells for Java API is unable to properly calculate the cell height & width for the given text in the shape. Consequently, the text seems to overflow the container boundaries. Please check the attached snapshot of the PDF generated on Windows platform that displays the text correctly. The snapshot lists the fonts that have been embedded in side the PDF. We wished you could have provided us the sample PDF from problematic machine for review. Please provide us two PDF files, one with correct results (from Linux system) and other with incorrect results (from MacOS system) for further troubleshooting.

Hi,
I have attached the pdf generated by mac and linux for you to investigate.

Hi Huangfu,


Thank you for the PDF files. I am now sure that the problem is only related to the missing fonts in your Mac OS environment. Please note, you need the Micosoft’s YaHei & SimSun fonts (TTF files) to be present on the Mac OS machine to properly render the text. These fonts are present in your Linux environment so you can simply copy the fonts on the other machine for testing purposes, and point the Aspose.Cells for Java API to the location of TTF files while using the CellsHelper.setFontDir method at the start of your application.

I have attached the snapshots of the fonts used in your provided PDF files. You will notice that the PDF generated on Linux lists the aforesaid fonts whereas the PDF generated on Mac OS is using Arial Unicode because the API was unable to find a suitable font to render all the glyphs so it tried to substitute the fonts.

Hi,
Thanks a lot. It’s solved now.

Hi Huangfu,


Its good to know that you are up & running again, Please feel free to get in touch if you need our further assistance with Aspose APIs.

The issues you have found earlier (filed as CELLSJAVA-41308) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.