C# Code Sample to Create PDF from HTML in REST API





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


stringstrURI = "http://api.aspose.com/v1.1/pdf/outPdfFile.pdf?templateFile=input.html&templateType=html";
stringsignedURI = Sign(strURI);
StreamReader reader = new StreamReader(ProcessCommand(signedURI, "PUT"));
//further process JSON response
stringstrJSON = reader.ReadToEnd();
//Parse the json string to JObject
JObjectparsedJSON = JObject.Parse(strJSON);
BaseResponse stream = JsonConvert.DeserializeObject<BaseResponse>(parsedJSON.ToString());
if (stream.Code == "200" &&stream.Status == "OK")
Console.WriteLine("Empty PDF file has been created successfully");

//Here is the BaseResponse class
public class BaseResponse
{
publicBaseResponse() { }
        public string Code { get; set; }
        public string Status { get; set; }
}


 

Katherine Johanson

Comments

There are currently no comments for this snippet.

Voting

Votes Up


Votes Down