Ruby Code Sample to Create PDF from HTML in REST





1
Date Submitted Thu. Apr. 10th, 2014 8:08 AM
Revision 1 of 1
Helper johansonkatherine
Tags API | create | File | from | HTML | in | pdf | REST | Ruby | Using
Comments 0 comments
This code sample shows how Ruby developers can create PDF file from HTML using Aspose.Pdf for Cloud API in their REST applications.


app_sid = '77******-1***-4***-a***-8***********'
app_key = '89******************************'
Aspose::Cloud::Common::AsposeApp.new(app_sid, app_key)

#build URI to create PDF from HTML
str_uri = 'http://api.aspose.com/v1.1/pdf/outPdfFile.pdf?templateFile=HtmlExample1.html&templateType=html'

#sign URI
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
RestClient.put(signed_uri, '', {:accept=>'application/json'})

#build URI to download output file
str_uri = 'http://api.aspose.com/v1.1/storage/file/outPdfFile.pdf'

#sign URI
signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)
response_stream = RestClient.get(signed_uri, :accept => 'application/json')
Aspose::Cloud::Common::Utils.save_file(response_stream, "outPdfFile.pdf")
p 'done'


 

Katherine Johanson

Comments

There are currently no comments for this snippet.

Voting

Votes Down