Free Support Forum -

Convert HTML to PDF with document margins using Aspose.PDF Cloud API

Hi there,

I’m creating a PDF from an HTML template and I need to set the PDF margins. How can I do this?

In my REST PUT request I’m sending as a content:

{“PageInfo”:{“Margin”:{“Bottom”:10,“Top”:20, “Left”: 5, “Right”: 5}}}

But it’s not working. I always get the PDF with the same (big) margins.

Please help.

Thank you!


Thanks for contacting support.

We are working on testing the scenario using our sample HTML documents and will keep you updated with our findings.


Any progress on this?

I have a customer waiting.

Thanks in advance!


Thanks for your patience. We are in the middle of testing and hope to share our findings, shortly.


Thanks for your patience.

After further investigation, we have found that currently Aspose.Pdf for Cloud do not support the feature to set page margin when converting HTML files to PDF format. For the sake of correction, I have logged this requirement as PDFCLOUD-52 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

As a workaround, you may consider setting Left and Right margin for input HTML file

I tried:

body {
font-family: Arial, sans-serif !important;
font-size: 16px;
margin: 0 !important;
padding: 0 !important;

But the final result is the same.

Kindly send us your complete code of Aspose for Cloud API request along with the source PDF document. We will investigate and share our findings with you.


So these are my request details:

Provider url:

Connector Url: ${target_pdf_file?url}?templateFile=${template_html_file?url}&templateType=html&appsid=${app_sid}&signature=${signature}

Method: PUT

Result format: JSON

Content: {“PageInfo”:{“Margin”:{“Bottom”:10,“Top”:20, “Left”: 5, “Right”: 5}}}

Content type: application/json

Please see attached HTML (1.7 KB)

We are working over your query and will get back to you soon.

We have logged a feature request under the ticket ID PDFCLOUD-52 in our issue tracking system and you will be able to set page margins once it is resolved. We will notify you once a significant progress has been made in this regard.

Thank you so much!


My customer requires an update on this issue, they are complaining about the amount of paper wasted due to the big margins.

Can you share a release date for this new feature?

Thank you!


Our Product team is working on this issue and I will let you know as soon as they fix this issue. Thanks for your understanding and have a good day.


You can use following API to Convert HTML to PDF with desired page margins.

PUT ​/pdf​/{name}​/create​/html