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

Free Support Forum - aspose.com

How to get paper size in pixel

worksheet.getPageSetup().getPaperSize() can return PaperSizeType.PAPER_A_4

I want to get the actual width/height in pixel.

How can I do this?


Thanks for your posting and using Aspose.Cells.

You can get the dimensions in the inches from the documentation. Just open the PaperSizeType.html as shown in the screenshot. You can find offline documentation in any latest release e.g. Aspose.Cells for Java 16.12.0,

I know doc has inch

But I just want to get the actual pixels in java code.

In aspose.cells 8.8.2

I can reflect call com.aspose.cells.zauu.a(PageSetup, double[], double[])
and com.aspose.cells.zatv.a(Worksheet, double[], double[], double, double)
that return the actual pixels

I want aspose.cells can make these methods public and no ofbz


Thanks for your posting and using Aspose.Cells.

We need more clarification of your requirements. I have attached the sample excel file. Please take a look on it and tell us what values do you want to get out of it. This will help us understand your requirements closely and precisely. Thanks for your cooperation in this regard and have a good day.

Now I just want let

com.aspose.cells.zauu.a(PageSetup, double[], double[]) to public and no obfuscate.

This method can return current paper size in inch.

In my case, I convert Worksheet to Image use com.aspose.cells.SheetRender.toImage(int, Graphics2D) to customize Graphics2D,
I can’t use save method to PNG/JPEG

This work fine, but I need some methods to get worksheet’s paper width/height in pixel.So I can init my customize Graphics2D dimension.


Thanks for your feedback and using Aspose.Cells.

We have logged your requirement in our database as a New Feature request. We will look into it and implement it if possible. Once, there is some fix or other news for you, we will let you know asap.

This issue has been logged as

  • CELLSJAVA-42132 - GetPaperWidth and GetPaperHeight methods needed in PageSetup


Please try our latest version/fix: Aspose.Cells for Java v16.12.5

We have fixed your issue now.

We have added getPaperWidth() and getPaperHeight() in PageSetup class.

Let us know your feedback.

Thank you.

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

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