Posted By

nausherwan on 05/28/14


Tagged

pdf cloud annotations AsposePdf Aspose


Versions (?)

Java Sample Code to Get a Specific Annotation from a PDF Page using Aspose.Pdf for Cloud


 / Published in: Java
 

URL: http://www.aspose.com/docs/display/pdfcloud/Get+a+Specific+Annotation+from+a+PDF+Page

Following sample code allows the developers to get a specific annotation from a PDF page using Aspose.Pdf for Cloud API in their applications. You can use our REST API with any language: .NET, Java, PHP, Ruby, Rails, Python, jQuery and many more.

  1. String appSID = "******************";
  2. String appKey = "******************";
  3.  
  4. //build URI to get selected annotation
  5. String strURI = "http://api.aspose.com/v1.1/pdf/input.pdf/pages/1/annotations/1";
  6. String signedURI = Sign(strURI);
  7. InputStream responseStream = ProcessCommand(signedURI, "GET");
  8. String strJSON = StreamToString(responseStream);
  9. Gson gson = new Gson();
  10. //Parse the json String to JObject and Deserializes the JSON to a object.
  11. AnnotationResponse annotationResponse = gson.fromJson(strJSON,AnnotationResponse.class);
  12. Annotation annotation = annotationResponse.getAnnotation();
  13.  
  14. //Here is the BaseResponse class
  15. public class BaseResponse
  16. {
  17. public BaseResponse() { }
  18. private String Code;
  19. private String Status;
  20. public String getCode(){return Code;}
  21. public String getStatus(){return Status;}
  22. public void setCode(String temCode){ Code=temCode;}
  23. public void setStatus(String temStatus){ Status=temStatus;}
  24. }
  25.  
  26. //Here is the AnnotationResponse class
  27. public class AnnotationResponse extends BaseResponse
  28. {
  29. public AnnotationResponse() { }
  30. public Annotation getAnnotation(){return Annotation;}
  31. public void setAnnotation(Annotation annotation){ Annotation=annotation;}
  32. }
  33.  
  34. //Here is the Annotation class
  35. public class Annotation
  36. {
  37. private Annotation() { }
  38. private Color Color;
  39. private String Contents;
  40. private String CreationDate;
  41. private String Subject;
  42. private String Title;
  43. private String Modified;
  44. public String getCreationDate(){return CreationDate;}
  45. public String getContents(){return Contents;}
  46. public String getSubject(){return Subject;}
  47. public String getTitle(){return Title;}
  48. public String getModified(){return Modified;}
  49. public Color getColor(){return Color;}
  50. public void setContents(String temContents){ Contents=temContents;}
  51. public void setSubject(String temSubject){ Subject=temSubject;}
  52. public void setTitle(String temTitle){ Title=temTitle;}
  53. public void setModified(String temModified){Modified=temModified;}
  54. public void SetColor(Color temColor){ Color=temColor;}
  55. }
  56.  
  57. //Here is the Color class
  58. public class Color
  59. {
  60. public Color() { }
  61. private int A;
  62. private int B;
  63. private int G;
  64. private int R;
  65. public int getA(){return A;}
  66. public int getB(){return B;}
  67. public int getG(){return G;}
  68. public int getR(){return R;}
  69. }

Report this snippet  

You need to login to post a comment.