Posted By

johansonkatherine on 04/10/14


Tagged

file java html ruby pdf new create from cloud api in for rest using creation c# AsposePdf cloudcreate cloudcreating PDFPdf


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Beppoi


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


 / Published in: C#
 

URL: http://www.aspose.com/docs/display/pdfcloud/Create+PDF+from+HTML

This code sample shows how C# developers can create PDF file from HTML using Aspose.Pdf for Cloud API in their REST applications.

  1. stringstrURI = "http://api.aspose.com/v1.1/pdf/outPdfFile.pdf?templateFile=input.html&templateType=html";
  2. stringsignedURI = Sign(strURI);
  3. StreamReader reader = new StreamReader(ProcessCommand(signedURI, "PUT"));
  4. //further process JSON response
  5. stringstrJSON = reader.ReadToEnd();
  6. //Parse the json string to JObject
  7. JObjectparsedJSON = JObject.Parse(strJSON);
  8. BaseResponse stream = JsonConvert.DeserializeObject<BaseResponse>(parsedJSON.ToString());
  9. if (stream.Code == "200" &&stream.Status == "OK")
  10. Console.WriteLine("Empty PDF file has been created successfully");
  11.  
  12. //Here is the BaseResponse class
  13. public class BaseResponse
  14. {
  15. publicBaseResponse() { }
  16. public string Code { get; set; }
  17. public string Status { get; set; }
  18. }

Report this snippet  

You need to login to post a comment.