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!
@praydesai,
Thanks for contacting support.
We are working on testing the scenario using our sample HTML documents and will keep you updated with our findings.
Hi
Any progress on this?
I have a customer waiting.
Thanks in advance!
@praydesai,
Thanks for your patience. We are in the middle of testing and hope to share our findings, shortly.
@praydesai,
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.
@praydesai,
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.
Hi,
So these are my request details:
Provider url: http://api.aspose.cloud/v1.1/pdf/
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 template.final_pdf_template.zip (1.7 KB)
@praydesai,
We are working over your query and will get back to you soon.
@praydesai,
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.
Hello,
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!
@praydesai
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.
@praydesai
You can use following API to Convert HTML to PDF with desired page margins.
PUT /pdf/{name}/create/html
Seems like this is still an issue, has anyone found a work around for setting margin on files when using Aspose PDF to convert HTML to PDF?
@James_Petty
The PutHtmlInStorageToPdf API method should fulfill your requirements. However, if you still face the issue, then please share your input file with us for investigation.