Java Code Sample to Create PDF from HTML in REST

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

//build uri to create empty pdf
    String strURI = "";
    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;}


Katherine Johanson


There are currently no comments for this snippet.


Votes Down