aspose_pdf_cloud 18.10.0 → 18.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +75 -6
  3. data/docs/Annotation.md +0 -3
  4. data/docs/AnnotationInfo.md +0 -3
  5. data/docs/CapStyle.md +11 -0
  6. data/docs/CaretAnnotation.md +26 -0
  7. data/docs/CaretAnnotationResponse.md +11 -0
  8. data/docs/CaretAnnotations.md +10 -0
  9. data/docs/CaretAnnotationsResponse.md +11 -0
  10. data/docs/CaretSymbol.md +11 -0
  11. data/docs/CircleAnnotation.md +3 -3
  12. data/docs/CommonFigureAnnotation.md +3 -3
  13. data/docs/File.md +13 -0
  14. data/docs/FilesResponse.md +11 -0
  15. data/docs/FreeTextAnnotation.md +3 -3
  16. data/docs/HighlightAnnotation.md +25 -0
  17. data/docs/HighlightAnnotationResponse.md +11 -0
  18. data/docs/HighlightAnnotations.md +10 -0
  19. data/docs/HighlightAnnotationsResponse.md +11 -0
  20. data/docs/InkAnnotation.md +26 -0
  21. data/docs/InkAnnotationResponse.md +11 -0
  22. data/docs/InkAnnotations.md +10 -0
  23. data/docs/InkAnnotationsResponse.md +11 -0
  24. data/docs/LineAnnotation.md +3 -3
  25. data/docs/MarkupAnnotation.md +3 -3
  26. data/docs/PdfApi.md +1036 -69
  27. data/docs/PolyAnnotation.md +3 -3
  28. data/docs/PolyLineAnnotation.md +3 -3
  29. data/docs/PolygonAnnotation.md +3 -3
  30. data/docs/PopupAnnotation.md +21 -0
  31. data/docs/PopupAnnotationResponse.md +11 -0
  32. data/docs/PopupAnnotationWithParent.md +22 -0
  33. data/docs/PopupAnnotations.md +10 -0
  34. data/docs/PopupAnnotationsResponse.md +11 -0
  35. data/docs/SquareAnnotation.md +3 -3
  36. data/docs/SquigglyAnnotation.md +25 -0
  37. data/docs/SquigglyAnnotationResponse.md +11 -0
  38. data/docs/SquigglyAnnotations.md +10 -0
  39. data/docs/SquigglyAnnotationsResponse.md +11 -0
  40. data/docs/StrikeOutAnnotation.md +25 -0
  41. data/docs/StrikeOutAnnotationResponse.md +11 -0
  42. data/docs/StrikeOutAnnotations.md +10 -0
  43. data/docs/StrikeOutAnnotationsResponse.md +11 -0
  44. data/docs/TextAnnotation.md +3 -3
  45. data/docs/UnderlineAnnotation.md +25 -0
  46. data/docs/UnderlineAnnotationResponse.md +11 -0
  47. data/docs/UnderlineAnnotations.md +10 -0
  48. data/docs/UnderlineAnnotationsResponse.md +11 -0
  49. data/lib/aspose_pdf_cloud.rb +33 -0
  50. data/lib/aspose_pdf_cloud/api/pdf_api.rb +4978 -2084
  51. data/lib/aspose_pdf_cloud/models/annotation.rb +6 -33
  52. data/lib/aspose_pdf_cloud/models/annotation_flags.rb +1 -0
  53. data/lib/aspose_pdf_cloud/models/annotation_info.rb +6 -33
  54. data/lib/aspose_pdf_cloud/models/annotation_state.rb +1 -0
  55. data/lib/aspose_pdf_cloud/models/annotation_type.rb +1 -0
  56. data/lib/aspose_pdf_cloud/models/annotations_info.rb +5 -2
  57. data/lib/aspose_pdf_cloud/models/annotations_info_response.rb +5 -2
  58. data/lib/aspose_pdf_cloud/models/antialiasing_processing_type.rb +1 -0
  59. data/lib/aspose_pdf_cloud/models/append_document.rb +5 -2
  60. data/lib/aspose_pdf_cloud/models/aspose_response.rb +5 -2
  61. data/lib/aspose_pdf_cloud/models/attachment.rb +5 -2
  62. data/lib/aspose_pdf_cloud/models/attachment_response.rb +5 -2
  63. data/lib/aspose_pdf_cloud/models/attachments.rb +5 -2
  64. data/lib/aspose_pdf_cloud/models/attachments_response.rb +5 -2
  65. data/lib/aspose_pdf_cloud/models/cap_style.rb +44 -0
  66. data/lib/aspose_pdf_cloud/models/caption_position.rb +1 -0
  67. data/lib/aspose_pdf_cloud/models/caret_annotation.rb +375 -0
  68. data/lib/aspose_pdf_cloud/models/caret_annotation_response.rb +225 -0
  69. data/lib/aspose_pdf_cloud/models/caret_annotations.rb +214 -0
  70. data/lib/aspose_pdf_cloud/models/caret_annotations_response.rb +225 -0
  71. data/lib/aspose_pdf_cloud/models/caret_symbol.rb +44 -0
  72. data/lib/aspose_pdf_cloud/models/circle_annotation.rb +36 -33
  73. data/lib/aspose_pdf_cloud/models/circle_annotation_response.rb +5 -2
  74. data/lib/aspose_pdf_cloud/models/circle_annotations.rb +5 -2
  75. data/lib/aspose_pdf_cloud/models/circle_annotations_response.rb +5 -2
  76. data/lib/aspose_pdf_cloud/models/color.rb +5 -2
  77. data/lib/aspose_pdf_cloud/models/color_depth.rb +1 -0
  78. data/lib/aspose_pdf_cloud/models/common_figure_annotation.rb +36 -33
  79. data/lib/aspose_pdf_cloud/models/compression_type.rb +1 -0
  80. data/lib/aspose_pdf_cloud/models/doc_format.rb +1 -0
  81. data/lib/aspose_pdf_cloud/models/doc_recognition_mode.rb +1 -0
  82. data/lib/aspose_pdf_cloud/models/document.rb +5 -2
  83. data/lib/aspose_pdf_cloud/models/document_page_response.rb +5 -2
  84. data/lib/aspose_pdf_cloud/models/document_pages_response.rb +5 -2
  85. data/lib/aspose_pdf_cloud/models/document_privilege.rb +5 -2
  86. data/lib/aspose_pdf_cloud/models/document_properties.rb +5 -2
  87. data/lib/aspose_pdf_cloud/models/document_properties_response.rb +5 -2
  88. data/lib/aspose_pdf_cloud/models/document_property.rb +5 -2
  89. data/lib/aspose_pdf_cloud/models/document_property_response.rb +5 -2
  90. data/lib/aspose_pdf_cloud/models/document_response.rb +5 -2
  91. data/lib/aspose_pdf_cloud/models/epub_recognition_mode.rb +1 -0
  92. data/lib/aspose_pdf_cloud/models/field.rb +5 -2
  93. data/lib/aspose_pdf_cloud/models/field_response.rb +5 -2
  94. data/lib/aspose_pdf_cloud/models/field_type.rb +1 -0
  95. data/lib/aspose_pdf_cloud/models/fields.rb +5 -2
  96. data/lib/aspose_pdf_cloud/models/fields_response.rb +5 -2
  97. data/lib/aspose_pdf_cloud/models/file.rb +246 -0
  98. data/lib/aspose_pdf_cloud/models/files_response.rb +227 -0
  99. data/lib/aspose_pdf_cloud/models/font_encoding_rules.rb +1 -0
  100. data/lib/aspose_pdf_cloud/models/font_saving_modes.rb +1 -0
  101. data/lib/aspose_pdf_cloud/models/font_styles.rb +1 -0
  102. data/lib/aspose_pdf_cloud/models/free_text_annotation.rb +36 -33
  103. data/lib/aspose_pdf_cloud/models/free_text_annotation_response.rb +5 -2
  104. data/lib/aspose_pdf_cloud/models/free_text_annotations.rb +5 -2
  105. data/lib/aspose_pdf_cloud/models/free_text_annotations_response.rb +5 -2
  106. data/lib/aspose_pdf_cloud/models/free_text_intent.rb +1 -0
  107. data/lib/aspose_pdf_cloud/models/highlight_annotation.rb +367 -0
  108. data/lib/aspose_pdf_cloud/models/highlight_annotation_response.rb +225 -0
  109. data/lib/aspose_pdf_cloud/models/highlight_annotations.rb +214 -0
  110. data/lib/aspose_pdf_cloud/models/highlight_annotations_response.rb +225 -0
  111. data/lib/aspose_pdf_cloud/models/horizontal_alignment.rb +1 -0
  112. data/lib/aspose_pdf_cloud/models/html_document_type.rb +1 -0
  113. data/lib/aspose_pdf_cloud/models/html_markup_generation_modes.rb +1 -0
  114. data/lib/aspose_pdf_cloud/models/image.rb +5 -2
  115. data/lib/aspose_pdf_cloud/models/image_response.rb +5 -2
  116. data/lib/aspose_pdf_cloud/models/image_src_type.rb +1 -0
  117. data/lib/aspose_pdf_cloud/models/image_template.rb +5 -2
  118. data/lib/aspose_pdf_cloud/models/image_templates_request.rb +5 -2
  119. data/lib/aspose_pdf_cloud/models/images.rb +5 -2
  120. data/lib/aspose_pdf_cloud/models/images_response.rb +5 -2
  121. data/lib/aspose_pdf_cloud/models/ink_annotation.rb +377 -0
  122. data/lib/aspose_pdf_cloud/models/ink_annotation_response.rb +225 -0
  123. data/lib/aspose_pdf_cloud/models/ink_annotations.rb +214 -0
  124. data/lib/aspose_pdf_cloud/models/ink_annotations_response.rb +225 -0
  125. data/lib/aspose_pdf_cloud/models/justification.rb +1 -0
  126. data/lib/aspose_pdf_cloud/models/letters_positioning_methods.rb +1 -0
  127. data/lib/aspose_pdf_cloud/models/line_annotation.rb +36 -33
  128. data/lib/aspose_pdf_cloud/models/line_annotation_response.rb +5 -2
  129. data/lib/aspose_pdf_cloud/models/line_annotations.rb +5 -2
  130. data/lib/aspose_pdf_cloud/models/line_annotations_response.rb +5 -2
  131. data/lib/aspose_pdf_cloud/models/line_ending.rb +1 -0
  132. data/lib/aspose_pdf_cloud/models/line_intent.rb +1 -0
  133. data/lib/aspose_pdf_cloud/models/line_spacing.rb +1 -0
  134. data/lib/aspose_pdf_cloud/models/link.rb +5 -2
  135. data/lib/aspose_pdf_cloud/models/link_action_type.rb +1 -0
  136. data/lib/aspose_pdf_cloud/models/link_annotation.rb +5 -2
  137. data/lib/aspose_pdf_cloud/models/link_annotation_response.rb +5 -2
  138. data/lib/aspose_pdf_cloud/models/link_annotations.rb +5 -2
  139. data/lib/aspose_pdf_cloud/models/link_annotations_response.rb +5 -2
  140. data/lib/aspose_pdf_cloud/models/link_element.rb +5 -2
  141. data/lib/aspose_pdf_cloud/models/link_highlighting_mode.rb +1 -0
  142. data/lib/aspose_pdf_cloud/models/margin_info.rb +5 -2
  143. data/lib/aspose_pdf_cloud/models/markup_annotation.rb +36 -33
  144. data/lib/aspose_pdf_cloud/models/merge_documents.rb +5 -2
  145. data/lib/aspose_pdf_cloud/models/optimize_options.rb +5 -2
  146. data/lib/aspose_pdf_cloud/models/page.rb +5 -2
  147. data/lib/aspose_pdf_cloud/models/page_word_count.rb +5 -2
  148. data/lib/aspose_pdf_cloud/models/pages.rb +5 -2
  149. data/lib/aspose_pdf_cloud/models/paragraph.rb +5 -2
  150. data/lib/aspose_pdf_cloud/models/parts_embedding_modes.rb +1 -0
  151. data/lib/aspose_pdf_cloud/models/pdf_a_type.rb +1 -0
  152. data/lib/aspose_pdf_cloud/models/point.rb +5 -2
  153. data/lib/aspose_pdf_cloud/models/poly_annotation.rb +36 -33
  154. data/lib/aspose_pdf_cloud/models/poly_intent.rb +1 -0
  155. data/lib/aspose_pdf_cloud/models/poly_line_annotation.rb +36 -33
  156. data/lib/aspose_pdf_cloud/models/poly_line_annotation_response.rb +5 -2
  157. data/lib/aspose_pdf_cloud/models/poly_line_annotations.rb +5 -2
  158. data/lib/aspose_pdf_cloud/models/poly_line_annotations_response.rb +5 -2
  159. data/lib/aspose_pdf_cloud/models/polygon_annotation.rb +36 -33
  160. data/lib/aspose_pdf_cloud/models/polygon_annotation_response.rb +5 -2
  161. data/lib/aspose_pdf_cloud/models/polygon_annotations.rb +5 -2
  162. data/lib/aspose_pdf_cloud/models/polygon_annotations_response.rb +5 -2
  163. data/lib/aspose_pdf_cloud/models/popup_annotation.rb +325 -0
  164. data/lib/aspose_pdf_cloud/models/popup_annotation_response.rb +225 -0
  165. data/lib/aspose_pdf_cloud/models/popup_annotation_with_parent.rb +335 -0
  166. data/lib/aspose_pdf_cloud/models/popup_annotations.rb +214 -0
  167. data/lib/aspose_pdf_cloud/models/popup_annotations_response.rb +225 -0
  168. data/lib/aspose_pdf_cloud/models/raster_images_saving_modes.rb +1 -0
  169. data/lib/aspose_pdf_cloud/models/rectangle_pdf.rb +5 -2
  170. data/lib/aspose_pdf_cloud/models/rotation.rb +1 -0
  171. data/lib/aspose_pdf_cloud/models/segment.rb +5 -2
  172. data/lib/aspose_pdf_cloud/models/shape_type.rb +1 -0
  173. data/lib/aspose_pdf_cloud/models/signature.rb +5 -2
  174. data/lib/aspose_pdf_cloud/models/signature_type.rb +1 -0
  175. data/lib/aspose_pdf_cloud/models/signature_verify_response.rb +5 -2
  176. data/lib/aspose_pdf_cloud/models/split_result.rb +5 -2
  177. data/lib/aspose_pdf_cloud/models/split_result_document.rb +5 -2
  178. data/lib/aspose_pdf_cloud/models/split_result_response.rb +5 -2
  179. data/lib/aspose_pdf_cloud/models/square_annotation.rb +36 -33
  180. data/lib/aspose_pdf_cloud/models/square_annotation_response.rb +5 -2
  181. data/lib/aspose_pdf_cloud/models/square_annotations.rb +5 -2
  182. data/lib/aspose_pdf_cloud/models/square_annotations_response.rb +5 -2
  183. data/lib/aspose_pdf_cloud/models/squiggly_annotation.rb +367 -0
  184. data/lib/aspose_pdf_cloud/models/squiggly_annotation_response.rb +225 -0
  185. data/lib/aspose_pdf_cloud/models/squiggly_annotations.rb +214 -0
  186. data/lib/aspose_pdf_cloud/models/squiggly_annotations_response.rb +225 -0
  187. data/lib/aspose_pdf_cloud/models/stamp.rb +5 -2
  188. data/lib/aspose_pdf_cloud/models/stamp_type.rb +1 -0
  189. data/lib/aspose_pdf_cloud/models/strike_out_annotation.rb +367 -0
  190. data/lib/aspose_pdf_cloud/models/strike_out_annotation_response.rb +225 -0
  191. data/lib/aspose_pdf_cloud/models/strike_out_annotations.rb +214 -0
  192. data/lib/aspose_pdf_cloud/models/strike_out_annotations_response.rb +225 -0
  193. data/lib/aspose_pdf_cloud/models/text_annotation.rb +36 -33
  194. data/lib/aspose_pdf_cloud/models/text_annotation_response.rb +5 -2
  195. data/lib/aspose_pdf_cloud/models/text_annotations.rb +5 -2
  196. data/lib/aspose_pdf_cloud/models/text_annotations_response.rb +5 -2
  197. data/lib/aspose_pdf_cloud/models/text_horizontal_alignment.rb +1 -0
  198. data/lib/aspose_pdf_cloud/models/text_icon.rb +1 -0
  199. data/lib/aspose_pdf_cloud/models/text_line.rb +5 -2
  200. data/lib/aspose_pdf_cloud/models/text_rect.rb +5 -2
  201. data/lib/aspose_pdf_cloud/models/text_rects.rb +5 -2
  202. data/lib/aspose_pdf_cloud/models/text_rects_response.rb +5 -2
  203. data/lib/aspose_pdf_cloud/models/text_replace.rb +5 -2
  204. data/lib/aspose_pdf_cloud/models/text_replace_list_request.rb +5 -2
  205. data/lib/aspose_pdf_cloud/models/text_replace_response.rb +5 -2
  206. data/lib/aspose_pdf_cloud/models/text_state.rb +5 -2
  207. data/lib/aspose_pdf_cloud/models/text_style.rb +5 -2
  208. data/lib/aspose_pdf_cloud/models/underline_annotation.rb +367 -0
  209. data/lib/aspose_pdf_cloud/models/underline_annotation_response.rb +225 -0
  210. data/lib/aspose_pdf_cloud/models/underline_annotations.rb +214 -0
  211. data/lib/aspose_pdf_cloud/models/underline_annotations_response.rb +225 -0
  212. data/lib/aspose_pdf_cloud/models/vertical_alignment.rb +1 -0
  213. data/lib/aspose_pdf_cloud/models/word_count.rb +5 -2
  214. data/lib/aspose_pdf_cloud/models/word_count_response.rb +5 -2
  215. data/lib/aspose_pdf_cloud/models/wrap_mode.rb +1 -0
  216. data/lib/aspose_pdf_cloud/version.rb +1 -1
  217. data/test/pdf_tests.rb +757 -21
  218. metadata +68 -2
@@ -20,6 +20,7 @@ SOFTWARE.
20
20
  =end
21
21
 
22
22
  require 'date'
23
+ require 'time'
23
24
 
24
25
  module AsposePdfCloud
25
26
  class VerticalAlignment
@@ -20,6 +20,7 @@ SOFTWARE.
20
20
  =end
21
21
 
22
22
  require 'date'
23
+ require 'time'
23
24
 
24
25
  module AsposePdfCloud
25
26
  # Number of words per document pages.
@@ -117,9 +118,11 @@ module AsposePdfCloud
117
118
  def _deserialize(type, value)
118
119
  case type.to_sym
119
120
  when :DateTime
120
- DateTime.parse(value)
121
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
122
+ Time.strptime(value, format).utc.to_datetime
121
123
  when :Date
122
- Date.parse(value)
124
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
125
+ Time.strptime(value, format).utc.to_datetime.to_date
123
126
  when :String
124
127
  value.to_s
125
128
  when :Integer
@@ -20,6 +20,7 @@ SOFTWARE.
20
20
  =end
21
21
 
22
22
  require 'date'
23
+ require 'time'
23
24
 
24
25
  module AsposePdfCloud
25
26
  # Number of words per document pages.
@@ -141,9 +142,11 @@ module AsposePdfCloud
141
142
  def _deserialize(type, value)
142
143
  case type.to_sym
143
144
  when :DateTime
144
- DateTime.parse(value)
145
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
146
+ Time.strptime(value, format).utc.to_datetime
145
147
  when :Date
146
- Date.parse(value)
148
+ format = (value.include? '+') ? '/Date(%Q%z)/' : '/Date(%Q)/'
149
+ Time.strptime(value, format).utc.to_datetime.to_date
147
150
  when :String
148
151
  value.to_s
149
152
  when :Integer
@@ -20,6 +20,7 @@ SOFTWARE.
20
20
  =end
21
21
 
22
22
  require 'date'
23
+ require 'time'
23
24
 
24
25
  module AsposePdfCloud
25
26
  class WrapMode
@@ -20,5 +20,5 @@ SOFTWARE.
20
20
  =end
21
21
 
22
22
  module AsposePdfCloud
23
- VERSION = "18.10.0"
23
+ VERSION = "18.11.0"
24
24
  end
@@ -31,7 +31,7 @@ class PdfTests < Minitest::Test
31
31
 
32
32
  def setup
33
33
  # Get App key and App SID from https://aspose.cloud
34
- @pdf_api = PdfApi.new('app_key', 'app_sid')
34
+ @pdf_api = PdfApi.new('95e2a135b1e1b5e8e6b4a97395b30213', 'b03fc72c-e765-4427-822c-8c50a6dd628a')
35
35
 
36
36
  @temp_folder = 'TempPdfCloud'
37
37
  @test_data_folder = '../test_data/'
@@ -47,7 +47,7 @@ class PdfTests < Minitest::Test
47
47
 
48
48
 
49
49
  def upload_file(file_name)
50
- response = @pdf_api.put_create(@temp_folder + '/' + file_name, File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) } )
50
+ response = @pdf_api.put_create(@temp_folder + '/' + file_name, ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) } )
51
51
  assert(response, "Failed to upload #{file_name} file.")
52
52
  end
53
53
 
@@ -804,6 +804,730 @@ class PdfTests < Minitest::Test
804
804
  assert(response, 'Failed to replace text annotation.')
805
805
  end
806
806
 
807
+ # Highlight Annotations Tests
808
+
809
+ def test_get_document_highlight_annotations
810
+ file_name = 'PdfWithAnnotations.pdf'
811
+ upload_file(file_name)
812
+
813
+ opts = {
814
+ :folder => @temp_folder
815
+ }
816
+
817
+ response = @pdf_api.get_document_highlight_annotations(file_name, opts)
818
+ assert(response, 'Failed to read document highlight annotations.')
819
+ end
820
+
821
+ def test_post_page_highlight_annotations
822
+ file_name = 'PdfWithAnnotations.pdf'
823
+ upload_file(file_name)
824
+
825
+ opts = {
826
+ :folder => @temp_folder
827
+ }
828
+
829
+ annotation = HighlightAnnotation.new
830
+ annotation.name = 'Test highlight'
831
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
832
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
833
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
834
+ annotation.rich_text = 'Rich Text'
835
+ annotation.subject = 'Subj'
836
+ annotation.z_index = 1
837
+ annotation.title = 'Title'
838
+ annotation.quad_points = [
839
+ Point.new({:X => 10, :Y => 10}),
840
+ Point.new({:X => 20, :Y => 10}),
841
+ Point.new({:X => 10, :Y => 20}),
842
+ Point.new({:X => 10, :Y => 10})
843
+ ]
844
+
845
+ response = @pdf_api.post_page_highlight_annotations(file_name, 1, [annotation], opts)
846
+ assert(response, 'Failed to add highlight annotations into page.')
847
+ end
848
+
849
+ def test_get_page_highlight_annotations
850
+ file_name = 'PdfWithAnnotations.pdf'
851
+ upload_file(file_name)
852
+
853
+ page_number = 1
854
+ opts = {
855
+ :folder => @temp_folder
856
+ }
857
+
858
+ response = @pdf_api.get_page_highlight_annotations(file_name, page_number, opts)
859
+ assert(response, 'Failed to read page highlight annotations.')
860
+ end
861
+
862
+ def test_get_highlight_annotation
863
+ file_name = 'PdfWithAnnotations.pdf'
864
+ upload_file(file_name)
865
+
866
+ opts = {
867
+ :folder => @temp_folder
868
+ }
869
+
870
+ annotations_response = @pdf_api.get_document_highlight_annotations(file_name, opts)
871
+ assert(annotations_response, 'Failed to read document highlight annotations.')
872
+ annotation_id = annotations_response[0].annotations.list[0].id
873
+
874
+ response = @pdf_api.get_highlight_annotation(file_name, annotation_id, opts)
875
+ assert(response, 'Failed to read page highlight annotations.')
876
+ end
877
+
878
+ def test_put_highlight_annotation
879
+ file_name = 'PdfWithAnnotations.pdf'
880
+ upload_file(file_name)
881
+
882
+ opts = {
883
+ :folder => @temp_folder
884
+ }
885
+
886
+ annotation = HighlightAnnotation.new
887
+ annotation.name = 'Test highlight'
888
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
889
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
890
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
891
+ annotation.rich_text = 'Rich Text'
892
+ annotation.subject = 'Subj'
893
+ annotation.z_index = 1
894
+ annotation.quad_points = [
895
+ Point.new({:X => 10, :Y => 10}),
896
+ Point.new({:X => 20, :Y => 10}),
897
+ Point.new({:X => 10, :Y => 20}),
898
+ Point.new({:X => 10, :Y => 10})
899
+ ]
900
+
901
+ annotations_response = @pdf_api.get_document_highlight_annotations(file_name, opts)
902
+ assert(annotations_response, 'Failed to read document highlight annotations.')
903
+ annotation_id = annotations_response[0].annotations.list[0].id
904
+
905
+ response = @pdf_api.put_highlight_annotation(file_name, annotation_id, annotation, opts)
906
+ assert(response, 'Failed to replace highlight annotation.')
907
+ end
908
+
909
+ # Underline Annotations Tests
910
+
911
+ def test_get_document_underline_annotations
912
+ file_name = 'PdfWithAnnotations.pdf'
913
+ upload_file(file_name)
914
+
915
+ opts = {
916
+ :folder => @temp_folder
917
+ }
918
+
919
+ response = @pdf_api.get_document_underline_annotations(file_name, opts)
920
+ assert(response, 'Failed to read document underline annotations.')
921
+ end
922
+
923
+ def test_post_page_underline_annotations
924
+ file_name = 'PdfWithAnnotations.pdf'
925
+ upload_file(file_name)
926
+
927
+ opts = {
928
+ :folder => @temp_folder
929
+ }
930
+
931
+ annotation = UnderlineAnnotation.new
932
+ annotation.name = 'Test underline'
933
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
934
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
935
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
936
+ annotation.rich_text = 'Rich Text'
937
+ annotation.subject = 'Subj'
938
+ annotation.z_index = 1
939
+ annotation.title = 'Title'
940
+ annotation.quad_points = [
941
+ Point.new({:X => 10, :Y => 10}),
942
+ Point.new({:X => 20, :Y => 10}),
943
+ Point.new({:X => 10, :Y => 20}),
944
+ Point.new({:X => 10, :Y => 10})
945
+ ]
946
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
947
+
948
+ response = @pdf_api.post_page_underline_annotations(file_name, 1, [annotation], opts)
949
+ assert(response, 'Failed to add underline annotations into page.')
950
+ end
951
+
952
+ def test_get_page_underline_annotations
953
+ file_name = 'PdfWithAnnotations.pdf'
954
+ upload_file(file_name)
955
+
956
+ page_number = 1
957
+ opts = {
958
+ :folder => @temp_folder
959
+ }
960
+
961
+ response = @pdf_api.get_page_underline_annotations(file_name, page_number, opts)
962
+ assert(response, 'Failed to read page underline annotations.')
963
+ end
964
+
965
+ def test_get_underline_annotation
966
+ file_name = 'PdfWithAnnotations.pdf'
967
+ upload_file(file_name)
968
+
969
+ opts = {
970
+ :folder => @temp_folder
971
+ }
972
+
973
+ annotations_response = @pdf_api.get_document_underline_annotations(file_name, opts)
974
+ assert(annotations_response, 'Failed to read document underline annotations.')
975
+ annotation_id = annotations_response[0].annotations.list[0].id
976
+
977
+ response = @pdf_api.get_underline_annotation(file_name, annotation_id, opts)
978
+ assert(response, 'Failed to read page underline annotations.')
979
+ end
980
+
981
+ def test_put_underline_annotation
982
+ file_name = 'PdfWithAnnotations.pdf'
983
+ upload_file(file_name)
984
+
985
+ opts = {
986
+ :folder => @temp_folder
987
+ }
988
+
989
+ annotation = UnderlineAnnotation.new
990
+ annotation.name = 'Test underline'
991
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
992
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
993
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
994
+ annotation.rich_text = 'Rich Text'
995
+ annotation.subject = 'Subj'
996
+ annotation.z_index = 1
997
+ annotation.quad_points = [
998
+ Point.new({:X => 10, :Y => 10}),
999
+ Point.new({:X => 20, :Y => 10}),
1000
+ Point.new({:X => 10, :Y => 20}),
1001
+ Point.new({:X => 10, :Y => 10})
1002
+ ]
1003
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
1004
+
1005
+ annotations_response = @pdf_api.get_document_underline_annotations(file_name, opts)
1006
+ assert(annotations_response, 'Failed to read document underline annotations.')
1007
+ annotation_id = annotations_response[0].annotations.list[0].id
1008
+
1009
+ response = @pdf_api.put_underline_annotation(file_name, annotation_id, annotation, opts)
1010
+ assert(response, 'Failed to replace underline annotation.')
1011
+ end
1012
+
1013
+ # Squiggly Annotations Tests
1014
+
1015
+ def test_get_document_squiggly_annotations
1016
+ file_name = 'PdfWithAnnotations.pdf'
1017
+ upload_file(file_name)
1018
+
1019
+ opts = {
1020
+ :folder => @temp_folder
1021
+ }
1022
+
1023
+ response = @pdf_api.get_document_squiggly_annotations(file_name, opts)
1024
+ assert(response, 'Failed to read document squiggly annotations.')
1025
+ end
1026
+
1027
+ def test_post_page_squiggly_annotations
1028
+ file_name = 'PdfWithAnnotations.pdf'
1029
+ upload_file(file_name)
1030
+
1031
+ opts = {
1032
+ :folder => @temp_folder
1033
+ }
1034
+
1035
+ annotation = SquigglyAnnotation.new
1036
+ annotation.name = 'Test squiggly'
1037
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1038
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
1039
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
1040
+ annotation.rich_text = 'Rich Text'
1041
+ annotation.subject = 'Subj'
1042
+ annotation.z_index = 1
1043
+ annotation.title = 'Title'
1044
+ annotation.quad_points = [
1045
+ Point.new({:X => 10, :Y => 10}),
1046
+ Point.new({:X => 20, :Y => 10}),
1047
+ Point.new({:X => 10, :Y => 20}),
1048
+ Point.new({:X => 10, :Y => 10})
1049
+ ]
1050
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
1051
+
1052
+ response = @pdf_api.post_page_squiggly_annotations(file_name, 1, [annotation], opts)
1053
+ assert(response, 'Failed to add squiggly annotations into page.')
1054
+ end
1055
+
1056
+ def test_get_page_squiggly_annotations
1057
+ file_name = 'PdfWithAnnotations.pdf'
1058
+ upload_file(file_name)
1059
+
1060
+ page_number = 1
1061
+ opts = {
1062
+ :folder => @temp_folder
1063
+ }
1064
+
1065
+ response = @pdf_api.get_page_squiggly_annotations(file_name, page_number, opts)
1066
+ assert(response, 'Failed to read page squiggly annotations.')
1067
+ end
1068
+
1069
+ def test_get_squiggly_annotation
1070
+ file_name = 'PdfWithAnnotations.pdf'
1071
+ upload_file(file_name)
1072
+
1073
+ opts = {
1074
+ :folder => @temp_folder
1075
+ }
1076
+
1077
+ annotations_response = @pdf_api.get_document_squiggly_annotations(file_name, opts)
1078
+ assert(annotations_response, 'Failed to read document squiggly annotations.')
1079
+ annotation_id = annotations_response[0].annotations.list[0].id
1080
+
1081
+ response = @pdf_api.get_squiggly_annotation(file_name, annotation_id, opts)
1082
+ assert(response, 'Failed to read page squiggly annotations.')
1083
+ end
1084
+
1085
+ def test_put_squiggly_annotation
1086
+ file_name = 'PdfWithAnnotations.pdf'
1087
+ upload_file(file_name)
1088
+
1089
+ opts = {
1090
+ :folder => @temp_folder
1091
+ }
1092
+
1093
+ annotation = SquigglyAnnotation.new
1094
+ annotation.name = 'Test squiggly'
1095
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1096
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
1097
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
1098
+ annotation.rich_text = 'Rich Text'
1099
+ annotation.subject = 'Subj'
1100
+ annotation.z_index = 1
1101
+ annotation.quad_points = [
1102
+ Point.new({:X => 10, :Y => 10}),
1103
+ Point.new({:X => 20, :Y => 10}),
1104
+ Point.new({:X => 10, :Y => 20}),
1105
+ Point.new({:X => 10, :Y => 10})
1106
+ ]
1107
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
1108
+
1109
+ annotations_response = @pdf_api.get_document_squiggly_annotations(file_name, opts)
1110
+ assert(annotations_response, 'Failed to read document squiggly annotations.')
1111
+ annotation_id = annotations_response[0].annotations.list[0].id
1112
+
1113
+ response = @pdf_api.put_squiggly_annotation(file_name, annotation_id, annotation, opts)
1114
+ assert(response, 'Failed to replace squiggly annotation.')
1115
+ end
1116
+
1117
+ # StrikeOut Annotations Tests
1118
+
1119
+ def test_get_document_strike_out_annotations
1120
+ file_name = 'PdfWithAnnotations.pdf'
1121
+ upload_file(file_name)
1122
+
1123
+ opts = {
1124
+ :folder => @temp_folder
1125
+ }
1126
+
1127
+ response = @pdf_api.get_document_strike_out_annotations(file_name, opts)
1128
+ assert(response, 'Failed to read document strikeout annotations.')
1129
+ end
1130
+
1131
+ def test_post_page_strike_out_annotations
1132
+ file_name = 'PdfWithAnnotations.pdf'
1133
+ upload_file(file_name)
1134
+
1135
+ opts = {
1136
+ :folder => @temp_folder
1137
+ }
1138
+
1139
+ annotation = StrikeOutAnnotation.new
1140
+ annotation.name = 'Test strike_out'
1141
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1142
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
1143
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
1144
+ annotation.rich_text = 'Rich Text'
1145
+ annotation.subject = 'Subj'
1146
+ annotation.z_index = 1
1147
+ annotation.title = 'Title'
1148
+ annotation.quad_points = [
1149
+ Point.new({:X => 10, :Y => 10}),
1150
+ Point.new({:X => 20, :Y => 10}),
1151
+ Point.new({:X => 10, :Y => 20}),
1152
+ Point.new({:X => 10, :Y => 10})
1153
+ ]
1154
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
1155
+
1156
+ response = @pdf_api.post_page_strike_out_annotations(file_name, 1, [annotation], opts)
1157
+ assert(response, 'Failed to add strikeout annotations into page.')
1158
+ end
1159
+
1160
+ def test_get_page_strike_out_annotations
1161
+ file_name = 'PdfWithAnnotations.pdf'
1162
+ upload_file(file_name)
1163
+
1164
+ page_number = 1
1165
+ opts = {
1166
+ :folder => @temp_folder
1167
+ }
1168
+
1169
+ response = @pdf_api.get_page_strike_out_annotations(file_name, page_number, opts)
1170
+ assert(response, 'Failed to read page strikeout annotations.')
1171
+ end
1172
+
1173
+ def test_get_strike_out_annotation
1174
+ file_name = 'PdfWithAnnotations.pdf'
1175
+ upload_file(file_name)
1176
+
1177
+ opts = {
1178
+ :folder => @temp_folder
1179
+ }
1180
+
1181
+ annotations_response = @pdf_api.get_document_strike_out_annotations(file_name, opts)
1182
+ assert(annotations_response, 'Failed to read document strikeout annotations.')
1183
+ annotation_id = annotations_response[0].annotations.list[0].id
1184
+
1185
+ response = @pdf_api.get_strike_out_annotation(file_name, annotation_id, opts)
1186
+ assert(response, 'Failed to read page strikeout annotations.')
1187
+ end
1188
+
1189
+ def test_put_strike_out_annotation
1190
+ file_name = 'PdfWithAnnotations.pdf'
1191
+ upload_file(file_name)
1192
+
1193
+ opts = {
1194
+ :folder => @temp_folder
1195
+ }
1196
+
1197
+ annotation = StrikeOutAnnotation.new
1198
+ annotation.name = 'Test strike_out'
1199
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1200
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
1201
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
1202
+ annotation.rich_text = 'Rich Text'
1203
+ annotation.subject = 'Subj'
1204
+ annotation.z_index = 1
1205
+ annotation.quad_points = [
1206
+ Point.new({:X => 10, :Y => 10}),
1207
+ Point.new({:X => 20, :Y => 10}),
1208
+ Point.new({:X => 10, :Y => 20}),
1209
+ Point.new({:X => 10, :Y => 10})
1210
+ ]
1211
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
1212
+
1213
+ annotations_response = @pdf_api.get_document_strike_out_annotations(file_name, opts)
1214
+ assert(annotations_response, 'Failed to read document strikeout annotations.')
1215
+ annotation_id = annotations_response[0].annotations.list[0].id
1216
+
1217
+ response = @pdf_api.put_strike_out_annotation(file_name, annotation_id, annotation, opts)
1218
+ assert(response, 'Failed to replace strikeout annotation.')
1219
+ end
1220
+
1221
+ # Caret Annotations Tests
1222
+
1223
+ def test_get_document_caret_annotations
1224
+ file_name = 'PdfWithAnnotations.pdf'
1225
+ upload_file(file_name)
1226
+
1227
+ opts = {
1228
+ :folder => @temp_folder
1229
+ }
1230
+
1231
+ response = @pdf_api.get_document_caret_annotations(file_name, opts)
1232
+ assert(response, 'Failed to read document caret annotations.')
1233
+ end
1234
+
1235
+ def test_post_page_caret_annotations
1236
+ file_name = 'PdfWithAnnotations.pdf'
1237
+ upload_file(file_name)
1238
+
1239
+ opts = {
1240
+ :folder => @temp_folder
1241
+ }
1242
+
1243
+ annotation = CaretAnnotation.new
1244
+ annotation.name = 'Test caret'
1245
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1246
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
1247
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
1248
+ annotation.rich_text = 'Rich Text'
1249
+ annotation.subject = 'Subj'
1250
+ annotation.z_index = 1
1251
+ annotation.title = 'Title'
1252
+ annotation.frame = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1253
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
1254
+
1255
+ response = @pdf_api.post_page_caret_annotations(file_name, 1, [annotation], opts)
1256
+ assert(response, 'Failed to add caret annotations into page.')
1257
+ end
1258
+
1259
+ def test_get_page_caret_annotations
1260
+ file_name = 'PdfWithAnnotations.pdf'
1261
+ upload_file(file_name)
1262
+
1263
+ page_number = 1
1264
+ opts = {
1265
+ :folder => @temp_folder
1266
+ }
1267
+
1268
+ response = @pdf_api.get_page_caret_annotations(file_name, page_number, opts)
1269
+ assert(response, 'Failed to read page caret annotations.')
1270
+ end
1271
+
1272
+ def test_get_caret_annotation
1273
+ file_name = 'PdfWithAnnotations.pdf'
1274
+ upload_file(file_name)
1275
+
1276
+ opts = {
1277
+ :folder => @temp_folder
1278
+ }
1279
+
1280
+ annotations_response = @pdf_api.get_document_caret_annotations(file_name, opts)
1281
+ assert(annotations_response, 'Failed to read document caret annotations.')
1282
+ annotation_id = annotations_response[0].annotations.list[0].id
1283
+
1284
+ response = @pdf_api.get_caret_annotation(file_name, annotation_id, opts)
1285
+ assert(response, 'Failed to read page caret annotations.')
1286
+ end
1287
+
1288
+ def test_put_caret_annotation
1289
+ file_name = 'PdfWithAnnotations.pdf'
1290
+ upload_file(file_name)
1291
+
1292
+ opts = {
1293
+ :folder => @temp_folder
1294
+ }
1295
+
1296
+ annotation = CaretAnnotation.new
1297
+ annotation.name = 'Test caret'
1298
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1299
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
1300
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
1301
+ annotation.rich_text = 'Rich Text'
1302
+ annotation.subject = 'Subj'
1303
+ annotation.z_index = 1
1304
+ annotation.frame = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1305
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
1306
+
1307
+ annotations_response = @pdf_api.get_document_caret_annotations(file_name, opts)
1308
+ assert(annotations_response, 'Failed to read document caret annotations.')
1309
+ annotation_id = annotations_response[0].annotations.list[0].id
1310
+
1311
+ response = @pdf_api.put_caret_annotation(file_name, annotation_id, annotation, opts)
1312
+ assert(response, 'Failed to replace caret annotation.')
1313
+ end
1314
+
1315
+ # Ink Annotations Tests
1316
+
1317
+ def test_get_document_ink_annotations
1318
+ file_name = 'PdfWithAnnotations.pdf'
1319
+ upload_file(file_name)
1320
+
1321
+ opts = {
1322
+ :folder => @temp_folder
1323
+ }
1324
+
1325
+ response = @pdf_api.get_document_ink_annotations(file_name, opts)
1326
+ assert(response, 'Failed to read document ink annotations.')
1327
+ end
1328
+
1329
+ def test_post_page_ink_annotations
1330
+ file_name = 'PdfWithAnnotations.pdf'
1331
+ upload_file(file_name)
1332
+
1333
+ opts = {
1334
+ :folder => @temp_folder
1335
+ }
1336
+
1337
+ annotation = InkAnnotation.new
1338
+ annotation.name = 'Test ink'
1339
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1340
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
1341
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
1342
+ annotation.rich_text = 'Rich Text'
1343
+ annotation.subject = 'Subj'
1344
+ annotation.z_index = 1
1345
+ annotation.title = 'Title'
1346
+ annotation.ink_list = [
1347
+ [
1348
+ Point.new({:X => 10, :Y => 40}),
1349
+ Point.new({:X => 30, :Y => 40})
1350
+ ],
1351
+ [
1352
+ Point.new({:X => 10, :Y => 20}),
1353
+ Point.new({:X => 20, :Y => 20}),
1354
+ Point.new({:X => 30, :Y => 20})
1355
+ ]
1356
+ ]
1357
+ annotation.cap_style = CapStyle::ROUNDED
1358
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
1359
+
1360
+ response = @pdf_api.post_page_ink_annotations(file_name, 1, [annotation], opts)
1361
+ assert(response, 'Failed to add ink annotations into page.')
1362
+ end
1363
+
1364
+ def test_get_page_ink_annotations
1365
+ file_name = 'PdfWithAnnotations.pdf'
1366
+ upload_file(file_name)
1367
+
1368
+ page_number = 1
1369
+ opts = {
1370
+ :folder => @temp_folder
1371
+ }
1372
+
1373
+ response = @pdf_api.get_page_ink_annotations(file_name, page_number, opts)
1374
+ assert(response, 'Failed to read page ink annotations.')
1375
+ end
1376
+
1377
+ def test_get_ink_annotation
1378
+ file_name = 'PdfWithAnnotations.pdf'
1379
+ upload_file(file_name)
1380
+
1381
+ opts = {
1382
+ :folder => @temp_folder
1383
+ }
1384
+
1385
+ annotations_response = @pdf_api.get_document_ink_annotations(file_name, opts)
1386
+ assert(annotations_response, 'Failed to read document ink annotations.')
1387
+ annotation_id = annotations_response[0].annotations.list[0].id
1388
+
1389
+ response = @pdf_api.get_ink_annotation(file_name, annotation_id, opts)
1390
+ assert(response, 'Failed to read page ink annotations.')
1391
+ end
1392
+
1393
+ def test_put_ink_annotation
1394
+ file_name = 'PdfWithAnnotations.pdf'
1395
+ upload_file(file_name)
1396
+
1397
+ opts = {
1398
+ :folder => @temp_folder
1399
+ }
1400
+
1401
+ annotation = InkAnnotation.new
1402
+ annotation.name = 'Test ink'
1403
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1404
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
1405
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
1406
+ annotation.rich_text = 'Rich Text'
1407
+ annotation.subject = 'Subj'
1408
+ annotation.z_index = 1
1409
+ annotation.ink_list = [
1410
+ [
1411
+ Point.new({:X => 10, :Y => 40}),
1412
+ Point.new({:X => 30, :Y => 40})
1413
+ ],
1414
+ [
1415
+ Point.new({:X => 10, :Y => 20}),
1416
+ Point.new({:X => 20, :Y => 20}),
1417
+ Point.new({:X => 30, :Y => 20})
1418
+ ]
1419
+ ]
1420
+ annotation.cap_style = CapStyle::ROUNDED
1421
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
1422
+
1423
+ annotations_response = @pdf_api.get_document_ink_annotations(file_name, opts)
1424
+ assert(annotations_response, 'Failed to read document ink annotations.')
1425
+ annotation_id = annotations_response[0].annotations.list[0].id
1426
+
1427
+ response = @pdf_api.put_ink_annotation(file_name, annotation_id, annotation, opts)
1428
+ assert(response, 'Failed to replace ink annotation.')
1429
+ end
1430
+
1431
+ # Popup Annotations Tests
1432
+
1433
+ def test_get_document_popup_annotations
1434
+ file_name = 'PdfWithAnnotations.pdf'
1435
+ upload_file(file_name)
1436
+
1437
+ opts = {
1438
+ :folder => @temp_folder
1439
+ }
1440
+
1441
+ response = @pdf_api.get_document_popup_annotations(file_name, opts)
1442
+ assert(response, 'Failed to read document popup annotations.')
1443
+ end
1444
+
1445
+ def test_get_document_popup_annotations_by_parent
1446
+ file_name = 'PdfWithAnnotations.pdf'
1447
+ upload_file(file_name)
1448
+
1449
+ parent_id = 'GI5TAOZRGU3CYNZSGEWDCNZWFQ3TGOI'
1450
+ opts = {
1451
+ :folder => @temp_folder
1452
+ }
1453
+
1454
+ response = @pdf_api.get_document_popup_annotations_by_parent(file_name, parent_id, opts)
1455
+ assert(response, 'Failed to read document popup annotations.')
1456
+ end
1457
+
1458
+ def test_post_popup_annotation
1459
+ file_name = 'PdfWithAnnotations.pdf'
1460
+ upload_file(file_name)
1461
+
1462
+ parent_id = 'GI5TCMR3GE2TQLBSGM3CYMJYGUWDENRV'
1463
+ opts = {
1464
+ :folder => @temp_folder
1465
+ }
1466
+
1467
+ annotation = PopupAnnotation.new
1468
+ annotation.name = 'Test popup'
1469
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1470
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
1471
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
1472
+ annotation.z_index = 1
1473
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
1474
+
1475
+ response = @pdf_api.post_popup_annotation(file_name, parent_id, annotation, opts)
1476
+ assert(response, 'Failed to add popup annotations into page.')
1477
+ end
1478
+
1479
+ def test_get_page_popup_annotations
1480
+ file_name = 'PdfWithAnnotations.pdf'
1481
+ upload_file(file_name)
1482
+
1483
+ page_number = 1
1484
+ opts = {
1485
+ :folder => @temp_folder
1486
+ }
1487
+
1488
+ response = @pdf_api.get_page_popup_annotations(file_name, page_number, opts)
1489
+ assert(response, 'Failed to read page popup annotations.')
1490
+ end
1491
+
1492
+ def test_get_popup_annotation
1493
+ file_name = 'PdfWithAnnotations.pdf'
1494
+ upload_file(file_name)
1495
+
1496
+ opts = {
1497
+ :folder => @temp_folder
1498
+ }
1499
+
1500
+ annotations_response = @pdf_api.get_document_popup_annotations(file_name, opts)
1501
+ assert(annotations_response, 'Failed to read document popup annotations.')
1502
+ annotation_id = annotations_response[0].annotations.list[0].id
1503
+
1504
+ response = @pdf_api.get_popup_annotation(file_name, annotation_id, opts)
1505
+ assert(response, 'Failed to read page popup annotations.')
1506
+ end
1507
+
1508
+ def test_put_popup_annotation
1509
+ file_name = 'PdfWithAnnotations.pdf'
1510
+ upload_file(file_name)
1511
+
1512
+ opts = {
1513
+ :folder => @temp_folder
1514
+ }
1515
+
1516
+ annotation = PopupAnnotation.new
1517
+ annotation.name = 'Test popup'
1518
+ annotation.rect = RectanglePdf.new({:LLX => 100, :LLY => 100, :URX => 200, :URY => 200})
1519
+ annotation.flags = [AnnotationFlags::HIDDEN, AnnotationFlags::NO_VIEW]
1520
+ annotation.horizontal_alignment = HorizontalAlignment::CENTER
1521
+ annotation.z_index = 1
1522
+ annotation.modified = '02/02/2018 00:00:00.000 AM'
1523
+
1524
+ annotations_response = @pdf_api.get_document_popup_annotations(file_name, opts)
1525
+ assert(annotations_response, 'Failed to read document popup annotations.')
1526
+ annotation_id = annotations_response[0].annotations.list[0].id
1527
+
1528
+ response = @pdf_api.put_popup_annotation(file_name, annotation_id, annotation, opts)
1529
+ assert(response, 'Failed to replace popup annotation.')
1530
+ end
807
1531
 
808
1532
  # Append Tests
809
1533
 
@@ -938,7 +1662,7 @@ class PdfTests < Minitest::Test
938
1662
  res_file = 'result.doc'
939
1663
 
940
1664
  opts = {
941
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1665
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
942
1666
  # :file => @test_data_folder + file_name
943
1667
  }
944
1668
  response = @pdf_api.put_pdf_in_request_to_tiff(@temp_folder + '/' + res_file, opts)
@@ -975,7 +1699,7 @@ class PdfTests < Minitest::Test
975
1699
  res_file = 'result.pdf'
976
1700
 
977
1701
  opts = {
978
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1702
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
979
1703
  }
980
1704
  response = @pdf_api.put_pdf_in_request_to_pdf_a(@temp_folder + '/' + res_file, PdfAType::PDFA1_A, opts)
981
1705
  assert(response, 'Filed to convert PDF to PDFA.')
@@ -1011,7 +1735,7 @@ class PdfTests < Minitest::Test
1011
1735
  res_file = 'result.pdf'
1012
1736
 
1013
1737
  opts = {
1014
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1738
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1015
1739
  }
1016
1740
  response = @pdf_api.put_pdf_in_request_to_tiff(@temp_folder + '/' + res_file, opts)
1017
1741
  assert(response, 'Filed to convert PDF to Tiff.')
@@ -1047,7 +1771,7 @@ class PdfTests < Minitest::Test
1047
1771
  res_file = 'result.svg'
1048
1772
 
1049
1773
  opts = {
1050
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1774
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1051
1775
  }
1052
1776
  response = @pdf_api.put_pdf_in_request_to_svg(@temp_folder + '/' + res_file, opts)
1053
1777
  assert(response, 'Filed to convert PDF to SVG.')
@@ -1083,7 +1807,7 @@ class PdfTests < Minitest::Test
1083
1807
  res_file = 'result.xps'
1084
1808
 
1085
1809
  opts = {
1086
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1810
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1087
1811
  }
1088
1812
  response = @pdf_api.put_pdf_in_request_to_xps(@temp_folder + '/' + res_file, opts)
1089
1813
  assert(response, 'Filed to convert PDF to XPS.')
@@ -1119,7 +1843,7 @@ class PdfTests < Minitest::Test
1119
1843
  res_file = 'result.xls'
1120
1844
 
1121
1845
  opts = {
1122
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1846
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1123
1847
  }
1124
1848
  response = @pdf_api.put_pdf_in_request_to_xls(@temp_folder + '/' + res_file, opts)
1125
1849
  assert(response, 'Filed to convert PDF to XLS.')
@@ -1155,7 +1879,7 @@ class PdfTests < Minitest::Test
1155
1879
  res_file = 'result.zip'
1156
1880
 
1157
1881
  opts = {
1158
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1882
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1159
1883
  }
1160
1884
  response = @pdf_api.put_pdf_in_request_to_html(@temp_folder + '/' + res_file, opts)
1161
1885
  assert(response, 'Filed to convert PDF to HTML.')
@@ -1191,7 +1915,7 @@ class PdfTests < Minitest::Test
1191
1915
  res_file = 'result.epub'
1192
1916
 
1193
1917
  opts = {
1194
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1918
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1195
1919
  }
1196
1920
  response = @pdf_api.put_pdf_in_request_to_epub(@temp_folder + '/' + res_file, opts)
1197
1921
  assert(response, 'Filed to convert PDF to EPUB.')
@@ -1228,7 +1952,7 @@ class PdfTests < Minitest::Test
1228
1952
  res_file = 'result.pptx'
1229
1953
 
1230
1954
  opts = {
1231
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1955
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1232
1956
  }
1233
1957
  response = @pdf_api.put_pdf_in_request_to_pptx(@temp_folder + '/' + res_file, opts)
1234
1958
  assert(response, 'Filed to convert PDF to PPTX.')
@@ -1265,7 +1989,7 @@ class PdfTests < Minitest::Test
1265
1989
  res_file = 'result.latex'
1266
1990
 
1267
1991
  opts = {
1268
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1992
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1269
1993
  }
1270
1994
  response = @pdf_api.put_pdf_in_request_to_la_te_x(@temp_folder + '/' + res_file, opts)
1271
1995
  assert(response, 'Filed to convert PDF to LaTeX.')
@@ -1302,7 +2026,7 @@ class PdfTests < Minitest::Test
1302
2026
  res_file = 'result.mobi'
1303
2027
 
1304
2028
  opts = {
1305
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
2029
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1306
2030
  }
1307
2031
  response = @pdf_api.put_pdf_in_request_to_mobi_xml(@temp_folder + '/' + res_file, opts)
1308
2032
  assert(response, 'Filed to convert PDF to Moby Xml.')
@@ -1339,7 +2063,7 @@ class PdfTests < Minitest::Test
1339
2063
  res_file = 'result.pdf'
1340
2064
 
1341
2065
  opts = {
1342
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
2066
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1343
2067
  }
1344
2068
  response = @pdf_api.put_xfa_pdf_in_request_to_acro_form(@temp_folder + '/' + res_file, opts)
1345
2069
  assert(response, 'Filed to convert Xfa PDF to Acro form.')
@@ -1377,7 +2101,7 @@ class PdfTests < Minitest::Test
1377
2101
  res_file = 'result.xml'
1378
2102
 
1379
2103
  opts = {
1380
- :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
2104
+ :file => ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1381
2105
  }
1382
2106
  response = @pdf_api.put_pdf_in_request_to_xml(@temp_folder + '/' + res_file, opts)
1383
2107
  assert(response, 'Filed to convert PDF to Xml.')
@@ -1479,10 +2203,11 @@ class PdfTests < Minitest::Test
1479
2203
  html_file_name = 'HtmlWithImage.html'
1480
2204
  opts = {
1481
2205
  :height => 650,
1482
- :width => 250
2206
+ :width => 250,
2207
+ :html_file_name => html_file_name
1483
2208
  }
1484
2209
  src_path = @temp_folder + '/' + file_name
1485
- response = @pdf_api.get_html_in_storage_to_pdf(src_path, html_file_name, opts)
2210
+ response = @pdf_api.get_html_in_storage_to_pdf(src_path, opts)
1486
2211
  assert(response, 'Failed to convert html to pdf.')
1487
2212
  end
1488
2213
 
@@ -1497,9 +2222,10 @@ class PdfTests < Minitest::Test
1497
2222
  opts = {
1498
2223
  :dst_folder => @temp_folder,
1499
2224
  :height => 650,
1500
- :width => 250
2225
+ :width => 250,
2226
+ :html_file_name => html_file_name
1501
2227
  }
1502
- response = @pdf_api.put_html_in_storage_to_pdf(result_name, src_path, html_file_name, opts)
2228
+ response = @pdf_api.put_html_in_storage_to_pdf(result_name, src_path, opts)
1503
2229
  assert(response, 'Failed to convert html to pdf.')
1504
2230
  end
1505
2231
 
@@ -3021,12 +3747,12 @@ class PdfTests < Minitest::Test
3021
3747
  end
3022
3748
 
3023
3749
 
3024
- # Upload & Download Tests
3750
+ # Storage Tests
3025
3751
 
3026
3752
  def test_put_create
3027
3753
  file_name = '4pages.pdf'
3028
3754
 
3029
- response = @pdf_api.put_create(@temp_folder + '/' + file_name, File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) } )
3755
+ response = @pdf_api.put_create(@temp_folder + '/' + file_name, ::File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) } )
3030
3756
  assert(response, "Failed to upload #{file_name} file.")
3031
3757
  end
3032
3758
 
@@ -3038,4 +3764,14 @@ class PdfTests < Minitest::Test
3038
3764
  response = @pdf_api.get_download(@temp_folder + '/' + file_name)
3039
3765
  assert(response, "Failed to download #{file_name} file.")
3040
3766
  end
3767
+
3768
+ def test_get_list_files
3769
+
3770
+ opts = {
3771
+ :path => @temp_folder
3772
+ }
3773
+
3774
+ response = @pdf_api.get_list_files(opts)
3775
+ assert(response, 'Failed get file list.')
3776
+ end
3041
3777
  end