How to get the real page size when export to pdf

When set pdfSaveOptions.setAllColumnsInOnePagePerSheet(true);

Is it possible to get the real page size for each sheet?

Hi,

Thanks for your posting and using Aspose.Cells.

Yes, you can retrieve the paper size by using the SheetRender.getPageSize() method.

Please see the following sample code that explains how to get the real paper size of the sheet by setting the ImageOrPrintOptions.setAllColumnsInOnePagePerSheet(true)

Java


ImageOrPrintOptions options = new ImageOrPrintOptions();

options.setAllColumnsInOnePagePerSheet(true);


SheetRender sr = new SheetRender(worksheet, options);

float[] pageSize = sr.getPageSize(0);

Thanks a lot.
Then how to set the customized page size when export to pdf?

In pagesetup, I can only found set paper size which is predefined. But I won’t to set customized size which get from sheet render.

Hi Huangfu,

Thanks for your posting and using Aspose.Cells.

You cannot use customized paper size. You can only know what size of your PDF page will be once your Excel file is rendered to PDF by using the above code.