Convert Excel Spreadsheet to PDF with cURL using Aspose.Cells REST API

I am trying to export an excel spreadsheet to PDF using save options but I am constantly getting errors.

I have downloaded the sample app from Aspose cells for cloud Github and this is also throwing an error.

I am using the DotNet samples, and when I run the ConvertWorkbookWithAdditionalSettings method I get a error saying “Bytes to be written to the stream exceed the Content-Length bytes size specified.”

Even using the cUrl sample from Aspose cells API documentation gives an error.

Can you please let me know what is wrong?

Thanks

Hi,

Thank you for contacting support and sharing details.

We are able to reproduce this error at our end and trying to fix it at the earliest. We will update you in this thread once this error is fixed.

I am pleased to inform you that the error has bee fixed. Please update your local Aspose.Cells for Cloud Git repository before running ConvertWorkbookWithAdditionalSettings example. Once you rebuild project, Aspose.Cells NuGet package will automatically be updated to v1.0.10.

I’m still having issues with the straight web call using this function. Again using the samples from your website:

This works:

curl -v "http://api.aspose.cloud/v1.1/cells/convert?appSid=B01A15E5-1B83-4B9A-8EB3-0F2BFA6AC766&format=pdf&signature=TB0bshLiloxAdqEXe3shAdijzas" -X PUT -T Book1.xlsx -H "Content-Type: multipart/form-data" -H "Accept: multipart/form-data" -o Book1_out.pdf

But simply adding the -d paramter causes it to fail:

curl -v "http://api.aspose.cloud/v1.1/cells/convert?appSid=B01A15E5-1B83-4B9A-8EB3-0F2BFA6AC766&format=pdf&signature=TB0bshLiloxAdqEXe3shAdijzas" -X PUT -T Book1.xlsx -H "Content-Type: multipart/form-data" -H "Accept: multipart/form-data" -o Book1_out.pdf -d "{ "CalculateFormula": true, "CheckFontCompatibility": false, "Compliance": "None", "OnePagePerSheet": false, "SaveFormat": "PDF" }"

The error received is 400 Bad request

@Total_Synergy

We apologize for the inconvenience.

http://api.aspose.cloud/v1.1/cells/convert is a multipart request. So cURL example should be as follows:

curl -v "http://api.aspose.cloud/v1.1/cells/convert?format=pdf&appSID=xxxx&signature=xxxx" \
-X PUT \
-F "Sample_Book2.xls=@Sample_Book2.xls;type=application/vnd.ms-excel" \
-F 'json={"CalculateFormula": true, "CheckFontCompatibility": false, "Compliance": "None", "OnePagePerSheet": false, "SaveFormat": "PDF"};type=application/json' \
-H "Content-Type: multipart/form-data" \
-H "Accept: multipart/form-data" \
-o Sample_Book2.pdf

Should you need any further information, please do not hesitate to contact us.