Return to Snippet

Revision: 66275
at April 10, 2014 17:13 by johansonkatherine


Initial Code
//build uri to create empty pdf
    String strURI = "http://api.aspose.com/v1.1/pdf/outPdfFile.pdf?templateFile=input.html&templateType=html";
    String signedURI = Sign(strURI);
InputStreamresponseStream = ProcessCommand(signedURI, "PUT");
    String strJSON = StreamToString(responseStream);
Gsongson = new Gson();
    //Parse the json string to JObject and Deserializes the JSON to a object.
BaseResponsebaseResponse = gson.fromJson(strJSON,BaseResponse.class);
if (baseResponse.getCode().equals("200") &&baseResponse.getStatus().equals("OK"))
System.out.println("Empty PDF file has been created successfully");

//Here is the BaseResponse class
public class BaseResponse {
	publicBaseResponse() { }
	private String Code;
	private String Status;
	public String getCode(){return Code;}
	public String getStatus(){return Status;}
	public void  setCode(String temCode){ Code=temCode;}
	public void setStatus(String temStatus){ Status=temStatus;}
}

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

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

Initial Title
Java Code Sample to Create PDF from HTML Using REST API

Initial Tags
file, java, html, ruby, api, c#

Initial Language
Java