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

Free Support Forum - aspose.com

Chart to PDF rendering issues

I am using Aspose cells java version 8.5.2.


Following 2 issues are encountered while generating PDF from the chart:
1. Axis labels are not shown at all in the PDF.
2. Lot of small vertical lines appearing under the plot area.

However, the PDF generated directly from the MS Excel is flawless.

For your reference, the source excel file along with Aspose and MS Excel generated pdf files are attached herewith.

Following is the code snippet being used to generate PDF files:
Workbook workbook = new Workbook(“C:/temp/ChartIssue.xlsx”);

WorksheetCollection ws = workbook.getWorksheets();
Worksheet sheet1 = ws.get(“Workings”);
Chart chart = sheet1.getCharts().get(“Axis and Scale test”);
ChartShape cshape = chart.getChartObject();
int sheetIndex = ws.add();
Worksheet worksheet = ws.get(sheetIndex);

//Setting the name of the newly added worksheet
String transientSheetName = “TransientWorksheet”;
worksheet.setName(transientSheetName);

//Copy the Chart to Second Worksheet
worksheet.getShapes().addCopy(cshape, 0, 0, 0, 0);

//Get the new chart and set its height and width accordingly
Chart chart1 = worksheet.getCharts().get(0);
chart1.getChartObject().setHeight(cshape.getHeight());
chart1.getChartObject().setWidth(cshape.getWidth());
//Making remaining sheets invisible as the output is required for only TransientWorksheet
for (int i = 0; i < ws.getCount(); i++) {
String sheetName = ws.get(i).getName();
if(!transientSheetName.equalsIgnoreCase(sheetName)){
ws.get(i).setVisible(false);
}
}

PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();

pdfSaveOptions.setOnePagePerSheet(true);

worksheet.getPageSetup().setTopMargin(0);
worksheet.getPageSetup().setBottomMargin(0);
worksheet.getPageSetup().setRightMargin(0);
worksheet.getPageSetup().setLeftMargin(0);

workbook.save(“c:/temp/AsposeGenerated.pdf”, pdfSaveOptions);

Thanks,
Neeraj

Hi Neeraj,

Thank you for contacting Aspose support.

We have evaluated the presented scenario while using the latest revision of Aspose.Cells for Java 8.5.2, and we are able to replicate the mentioned as 2) in your original post. Regarding the point 1) the axis labels rendered in the PDF generated on my side, however, they are not in correct format as in Excel view. Please check the attachment for the resultant PDF generated on my side as well as the screenshots of the problem. In order to replicate the problem of missing axis labels, please provide more details of your environment such as Operation System version & JDK type/version.

That being said, we have recorded our observations regarding both points under the ticket CELLSJAVA-41464 for further investigation. Our product team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Hi,


The OS being used is Windows Server 2012 R2 and JDK version is 1.7

Thanks,
Neeraj

Hi Neeraj,

Thank you for sharing the environment details.

Please spare me some time to setup Windows Server 2012 R2 to give this scenario another try on my side. I will keep you posted with updates in this regard.

H again,


This is to update you that we have reevaluated the scenario on Windows Server 2008 R2 against JDK 1.7. Unfortunately, we were not able to replicate the problem of missing labels for chart’s horizontal axis while rendering the spreadsheet to PDF format. We have also discussed this matter with the concerned member of the product team to learn that the problem logged earlier as CELLSJAVA-41464 will be fixed with the next revision of the Aspose.Cells for Java. The aforesaid release will be passed on to you by the end of this week so you may test it on your side as well.

Hi Neeraj,


Please try the latest version of Aspose.Cells for Java 8.5.2.4 against the problem logged earlier as CELLSJAVA-41464 and let us know of your feedback.

@neergupta ,

Please try our latest version aspose-cells-21.6-java
Your issue should be fixed now .
Let us know your feedback.