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

Free Support Forum - aspose.cloud

How to convert HTML to PDF with cURL without Adobe?

Hi, i’m trying to understand from the docs the step 2 (https://docs.aspose.cloud/html/html-conversion-to_pdf/#step-2-initialize-an-asynchronous-conversion-process-using-the-post-method) about how to do the HTML to PDF conversion but i’m facing some issues, can you please provide me a cURL example?
I have not understand if in the inputPath parameter i have to insert the public url of the html file or the location of the file in my storage, same issues for the output…

Generally speaking a cURL example would be great :slight_smile:

Thank You

@system.antani

We are sorry for the inconvenience. We will update the documentation soon. Please find a sample POST cURL command to convert HTML to PDF using Aspose.HTML Cloud API.

HTML to PDF Converter REST API

# First get Access Token
# Get Customer Key and Customer ID from https://dashboard.aspose.cloud/
curl -X POST "https://api.aspose.cloud/connect/token" 
-d "grant_type=client_credentials&client_id=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxx" 
-H "Content-Type: application/x-www-form-urlencoded" 
-H "Accept: application/json"

#Convert HTML to PDF form local drive to cloud storage
curl -X POST "https://api.aspose.cloud/v3.0/html/convert/pdf?outPath=testhtml.pdf" 
-H "accept: application/json" 
-H "authorization: Bearer [Access_Token]" 
-H "Content-Type: multipart/form-data" 
-H "x-aspose-client: Containerize.Swagger" 
-F "file"="@C:/Temp/TestHtml.html"

# Download File from default Cloud Storage
curl -X GET "https://api.aspose.cloud/v3.0/html/storage/file/test.pdf" 
-H "accept: multipart/form-data" 
-H "authorization: Bearer [Access_Token]" 
--output C:/Temp/testhtml.pdf

Hi, thank you very much! One more small question, Is there also an example of HTML to PDF from local drive to “converted document in the response” ?
Thank you.

@system.antani

I am afraid currently Aspose.HTML Cloud API does not support converting HTML to PDF from local drive to response. We have logged a ticket(HTMLCLOUD-1805) for your requirement. We will notify you as soon as it is implemented.

Meanwhile, either you can download the resultant PDF document form cloud storage as following or you can use Aspose.Words Cloud ConvertDocument API method for the purpose.

curl -X GET "https://api.aspose.cloud/v3.0/html/storage/file/testhtml.pdf" 
-H "accept: multipart/form-data" 
-H "authorization: Bearer [Access_Token]" 
-H "x-aspose-client: Containerize.Swagger" 
--output C:/Temp/testhtml.pdf