pdfcrowd 5.0.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pdfcrowd.rb +154 -2
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc58c568c0a12634d68d5dac7c41204f0f85700625b51ca8a88e71d4b6561cf7
4
- data.tar.gz: a468401553b1ddaa4baf20d7941e0e5c62ed3f5a96b4a39dfb804186598454af
3
+ metadata.gz: b7043c685a1f94d4f4fc908be622607de34e3bc83df6c9b5c100baa6851e88b9
4
+ data.tar.gz: 940c31501059ef749182c3162f81309747684f43299b2f2c0ce32cc5efff345a
5
5
  SHA512:
6
- metadata.gz: 51baf77a8349fccdbd38959e3beca4d8db1640f28151ee58808c617679315a3b6aac98334e5a83549a9bd61d184391791bf5ecc210faf60195defc1dc05f7bbe
7
- data.tar.gz: 5b0f93f5c60e5e7eba9406deeed8d1d13d2a215dc98b55082c399c7a5816b109840b92c527f8f55662c9b2a7893aaf4defe5a3bf7da2c9fb492b10849c6cc9e6
6
+ metadata.gz: 26430785af23b2f5a1002dd3b5b58958297379cdf19fef474f8e772ae903834476d481bd0f5b97c83fc2694410fd8709ead4b74300036326b926a46a2d846b3c
7
+ data.tar.gz: 6372a0b8df9c3631110dab9fbcec8a42904503b15f3f6d43c6767b63b4f21232f4fed6e068a2dd8cd97094ebd1a5ca6e20ca02ccd84f44ff254bcafc81c136ab
data/lib/pdfcrowd.rb CHANGED
@@ -530,7 +530,7 @@ end
530
530
  module Pdfcrowd
531
531
  HOST = ENV["PDFCROWD_HOST"] || 'api.pdfcrowd.com'
532
532
  MULTIPART_BOUNDARY = '----------ThIs_Is_tHe_bOUnDary_$'
533
- CLIENT_VERSION = '5.0.0'
533
+ CLIENT_VERSION = '5.1.0'
534
534
 
535
535
  class ConnectionHelper
536
536
  def initialize(user_name, api_key)
@@ -541,7 +541,7 @@ module Pdfcrowd
541
541
 
542
542
  setProxy(nil, nil, nil, nil)
543
543
  setUseHttp(false)
544
- setUserAgent('pdfcrowd_ruby_client/5.0.0 (http://pdfcrowd.com)')
544
+ setUserAgent('pdfcrowd_ruby_client/5.1.0 (https://pdfcrowd.com)')
545
545
 
546
546
  @retry_count = 1
547
547
  @converter_version = '20.10'
@@ -895,6 +895,44 @@ module Pdfcrowd
895
895
  end
896
896
  end
897
897
 
898
+ # Convert an input stream.
899
+ #
900
+ # * +in_stream+ - The input stream with the source data.
901
+ # * *Returns* - Byte array containing the conversion output.
902
+ def convertStream(in_stream)
903
+ @raw_data['stream'] = in_stream.read
904
+ @helper.post(@fields, @files, @raw_data)
905
+ end
906
+
907
+ # Convert an input stream and write the result to an output stream.
908
+ #
909
+ # * +in_stream+ - The input stream with the source data.
910
+ # * +out_stream+ - The output stream that will contain the conversion output.
911
+ def convertStreamToStream(in_stream, out_stream)
912
+ @raw_data['stream'] = in_stream.read
913
+ @helper.post(@fields, @files, @raw_data, out_stream)
914
+ end
915
+
916
+ # Convert an input stream and write the result to a local file.
917
+ #
918
+ # * +in_stream+ - The input stream with the source data.
919
+ # * +file_path+ - The output file path. The string must not be empty.
920
+ def convertStreamToFile(in_stream, file_path)
921
+ if (!(!file_path.nil? && !file_path.empty?))
922
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertStreamToFile::file_path", "html-to-pdf", "The string must not be empty.", "convert_stream_to_file"), 470);
923
+ end
924
+
925
+ output_file = open(file_path, "wb")
926
+ begin
927
+ convertStreamToStream(in_stream, output_file)
928
+ output_file.close()
929
+ rescue Error => why
930
+ output_file.close()
931
+ FileUtils.rm(file_path)
932
+ raise
933
+ end
934
+ end
935
+
898
936
  # Set the output page size.
899
937
  #
900
938
  # * +size+ - Allowed values are A0, A1, A2, A3, A4, A5, A6, Letter.
@@ -2449,6 +2487,44 @@ module Pdfcrowd
2449
2487
  end
2450
2488
  end
2451
2489
 
2490
+ # Convert an input stream.
2491
+ #
2492
+ # * +in_stream+ - The input stream with the source data.
2493
+ # * *Returns* - Byte array containing the conversion output.
2494
+ def convertStream(in_stream)
2495
+ @raw_data['stream'] = in_stream.read
2496
+ @helper.post(@fields, @files, @raw_data)
2497
+ end
2498
+
2499
+ # Convert an input stream and write the result to an output stream.
2500
+ #
2501
+ # * +in_stream+ - The input stream with the source data.
2502
+ # * +out_stream+ - The output stream that will contain the conversion output.
2503
+ def convertStreamToStream(in_stream, out_stream)
2504
+ @raw_data['stream'] = in_stream.read
2505
+ @helper.post(@fields, @files, @raw_data, out_stream)
2506
+ end
2507
+
2508
+ # Convert an input stream and write the result to a local file.
2509
+ #
2510
+ # * +in_stream+ - The input stream with the source data.
2511
+ # * +file_path+ - The output file path. The string must not be empty.
2512
+ def convertStreamToFile(in_stream, file_path)
2513
+ if (!(!file_path.nil? && !file_path.empty?))
2514
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertStreamToFile::file_path", "html-to-image", "The string must not be empty.", "convert_stream_to_file"), 470);
2515
+ end
2516
+
2517
+ output_file = open(file_path, "wb")
2518
+ begin
2519
+ convertStreamToStream(in_stream, output_file)
2520
+ output_file.close()
2521
+ rescue Error => why
2522
+ output_file.close()
2523
+ FileUtils.rm(file_path)
2524
+ raise
2525
+ end
2526
+ end
2527
+
2452
2528
  # Set the input data for template rendering. The data format can be JSON, XML, YAML or CSV.
2453
2529
  #
2454
2530
  # * +data_string+ - The input data string.
@@ -3134,6 +3210,44 @@ module Pdfcrowd
3134
3210
  end
3135
3211
  end
3136
3212
 
3213
+ # Convert an input stream.
3214
+ #
3215
+ # * +in_stream+ - The input stream with the source data.
3216
+ # * *Returns* - Byte array containing the conversion output.
3217
+ def convertStream(in_stream)
3218
+ @raw_data['stream'] = in_stream.read
3219
+ @helper.post(@fields, @files, @raw_data)
3220
+ end
3221
+
3222
+ # Convert an input stream and write the result to an output stream.
3223
+ #
3224
+ # * +in_stream+ - The input stream with the source data.
3225
+ # * +out_stream+ - The output stream that will contain the conversion output.
3226
+ def convertStreamToStream(in_stream, out_stream)
3227
+ @raw_data['stream'] = in_stream.read
3228
+ @helper.post(@fields, @files, @raw_data, out_stream)
3229
+ end
3230
+
3231
+ # Convert an input stream and write the result to a local file.
3232
+ #
3233
+ # * +in_stream+ - The input stream with the source data.
3234
+ # * +file_path+ - The output file path. The string must not be empty.
3235
+ def convertStreamToFile(in_stream, file_path)
3236
+ if (!(!file_path.nil? && !file_path.empty?))
3237
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertStreamToFile::file_path", "image-to-image", "The string must not be empty.", "convert_stream_to_file"), 470);
3238
+ end
3239
+
3240
+ output_file = open(file_path, "wb")
3241
+ begin
3242
+ convertStreamToStream(in_stream, output_file)
3243
+ output_file.close()
3244
+ rescue Error => why
3245
+ output_file.close()
3246
+ FileUtils.rm(file_path)
3247
+ raise
3248
+ end
3249
+ end
3250
+
3137
3251
  # The format of the output file.
3138
3252
  #
3139
3253
  # * +output_format+ - Allowed values are png, jpg, gif, tiff, bmp, ico, ppm, pgm, pbm, pnm, psb, pct, ras, tga, sgi, sun, webp.
@@ -3947,6 +4061,44 @@ module Pdfcrowd
3947
4061
  end
3948
4062
  end
3949
4063
 
4064
+ # Convert an input stream.
4065
+ #
4066
+ # * +in_stream+ - The input stream with the source data.
4067
+ # * *Returns* - Byte array containing the conversion output.
4068
+ def convertStream(in_stream)
4069
+ @raw_data['stream'] = in_stream.read
4070
+ @helper.post(@fields, @files, @raw_data)
4071
+ end
4072
+
4073
+ # Convert an input stream and write the result to an output stream.
4074
+ #
4075
+ # * +in_stream+ - The input stream with the source data.
4076
+ # * +out_stream+ - The output stream that will contain the conversion output.
4077
+ def convertStreamToStream(in_stream, out_stream)
4078
+ @raw_data['stream'] = in_stream.read
4079
+ @helper.post(@fields, @files, @raw_data, out_stream)
4080
+ end
4081
+
4082
+ # Convert an input stream and write the result to a local file.
4083
+ #
4084
+ # * +in_stream+ - The input stream with the source data.
4085
+ # * +file_path+ - The output file path. The string must not be empty.
4086
+ def convertStreamToFile(in_stream, file_path)
4087
+ if (!(!file_path.nil? && !file_path.empty?))
4088
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertStreamToFile::file_path", "image-to-pdf", "The string must not be empty.", "convert_stream_to_file"), 470);
4089
+ end
4090
+
4091
+ output_file = open(file_path, "wb")
4092
+ begin
4093
+ convertStreamToStream(in_stream, output_file)
4094
+ output_file.close()
4095
+ rescue Error => why
4096
+ output_file.close()
4097
+ FileUtils.rm(file_path)
4098
+ raise
4099
+ end
4100
+ end
4101
+
3950
4102
  # Resize the image.
3951
4103
  #
3952
4104
  # * +resize+ - The resize percentage or new image dimensions.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdfcrowd
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pdfcrowd Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-08 00:00:00.000000000 Z
11
+ date: 2021-04-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The Pdfcrowd API lets you easily convert between HTML, PDF and various
14
14
  image formats.