How to update page layout in Excel to PDF conversion in Java with Aspose.Cells REST API

Hi Aspose’s Support,

I have converted Excel to Pdf as following sample :
https://docs.aspose.cloud/display/cellscloud/Convert+Excel+Workbook+to+Different+File+Formats

Here is my PDF Save Options :


true
true
false
None
400
95
false
Pdf


In my Excel, I can see total of 7 pages in PrintPreview. But in result convert PDF, I can see total of 14 pages.

Can you show me the root of this issue and how to fix it ?

Thanks,
Chien

Hi,


Thanks for the sample files and details.

After an initial test, I observed the issue as you mentioned with Cloud APIs. The problem is also replicated with latest revision of the Aspose.Cells for .NET 8.6.1.2 therefore we logged it as “CELLSNET-44048” in Nanjing Jira for correction purposes. I found the output layout of converting PDF from Excel file is not identical as per the Print Preview of the worksheet in MS Excel, it gives 14 pages instead of 7. I have logged a ticket with an id “SAASCELLS-133” (into Cloud JIRA) for your issue. As soon as a fix is made to the .NET APIs available, we would notify the respective team, so, they could integrate the fix in cloud service.

Thank you.


Hi,

Thanks for using Aspose.Cells.

For your issue logged as

  • CELLSNET-44048 - The output layout of converting PDF from Excel file is not good

The print quality in page setup is 200 DPI(workbook.Worksheets[0].PageSetup.PrintQuality), different print quality setting may cause different page layout. In the attachment, while using Adobe PDF Printer, there are multi print quality settings, you will find there are 12 pages in 72DPI print quality setting, but 7 pages in 600 DPI print quality setting. But for Microsoft XPS Document Writer Printer or Microsoft Print to PDF Printer, there is only one print quality setting(600 DPI) and there are 7 pages.

So to get same result as in MS Excel, set print quality to 600

DPI(workbook.Worksheets[0].PageSetup.PrintQuality = 600), before saving to pdf. The generated pdf is 7 pages.

Hi,


As you are using Cloud APIs, I am afraid, Aspose.Cells for Cloud does not support to set Print Quality (e.g via using XML string/ settings), the ticket is already logged as “SAASCELLS-133” into our database. Currently, you may try to set Print Quality in your underlying Excel file in MS Excel manually. And, once we develop this new feature for setting PrintQuality, we will integrate it to the live cloud service and let you know here.

Thank you.

Hi all,

Thanks all for your help. I can fix the issue with your suggestions

Best Regards,
Chien

Hi Chien,


Thank you for the confirmation. Please feel free to contact us back in case you need our further assistance with Aspose APIs.

Hi Chien,

This is to inform you that Aspose.Cells for Cloud service now allows to configure the Page Setup for a particular worksheet. You can now call the pagesetup API to set the Print Quality while using the following URI & XML.

curl -X POST "https://api.aspose.cloud/v3.0/cells/Book1.xlsx/worksheets/SHEET1/pagesetup" 
-H "accept: application/json" 
-H "authorization: Bearer [Access_Token]" 
-H "Content-Type: application/json" 
-H "x-aspose-client: Containerize.Swagger" -d "{ "PrintQuality": 600 }"

C#

string name = "Book1.xlsx";
string sheetName = "SHEET1";
PageSetup pageSetup = new PageSetup();
pageSetup.PrintQuality = 600;
string folder = null;
var response = cellsAPI.CellsPageSetupPostPageSetup(name, sheetName, pageSetup, folder);
Console.WriteLine(response);

Please note, we are currently working on the documentation for this newly added API therefore as soon as the API Reference is live, we will share the link here.

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


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