pdfcrowd 5.18.1 → 5.20.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 +478 -18
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c68f0aa0ecfdd6d82409454d49e2e921599153fb4812702823467adec87e05e0
4
- data.tar.gz: 4eca6b438238acf32c3053ca98b1bd1075799e63b39d51c98b0da111c47369f0
3
+ metadata.gz: ca4f095e5ea75c2cb312f3b2e8e3dab4dcf9dc9446e2ae858c8d31c42ceed5e5
4
+ data.tar.gz: b9106fc83ff0bd4255932da5f265f4aec382fc12845f52182d4b7550439cabc3
5
5
  SHA512:
6
- metadata.gz: 324b4434a7674ef7df9e565572ce413ae4ebdcc33277aa0c268c9a65197a74ab850b7f76959d73602d2b2c4fa5a816bd0f76a0f6b746b42dd3220edac904ea54
7
- data.tar.gz: e4cc61b5520c04e10e7cd4bb892d41dbe1e06caef6d2a496456ab3c4d2997a92ebef212995eacd87b5ddd7a18a6ffe03f175dfc78102269283d7a84378eb5399
6
+ metadata.gz: f4d0ba40598d6b635260887bd8a8dfb8bf0cdf71b5880bb70d2b5e00ebc99909e49d51b2b14122231720c571babe673e5236570934a47721ecb8d6c077b58f1e
7
+ data.tar.gz: 14eca890286ea656c45c78d5e96a3594e72b84c2f588c33c032a4c13d1aa7d81c7f11ab10b7fcbbd93985d7aa1c67ee3af5e9597c2fe63ef89839f007c5766e6
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.18.1'
533
+ CLIENT_VERSION = '5.20.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.18.1 (https://pdfcrowd.com)')
544
+ setUserAgent('pdfcrowd_ruby_client/5.20.0 (https://pdfcrowd.com)')
545
545
 
546
546
  @retry_count = 1
547
547
  @converter_version = '20.10'
@@ -1790,7 +1790,7 @@ module Pdfcrowd
1790
1790
  self
1791
1791
  end
1792
1792
 
1793
- # Set the rendering mode.
1793
+ # Set the rendering mode of the page, allowing control over how content is displayed.
1794
1794
  #
1795
1795
  # * +mode+ - The rendering mode. Allowed values are default, viewport.
1796
1796
  # * *Returns* - The converter object.
@@ -2389,11 +2389,11 @@ module Pdfcrowd
2389
2389
 
2390
2390
  # Set the converter version. Different versions may produce different output. Choose which one provides the best output for your case.
2391
2391
  #
2392
- # * +version+ - The version identifier. Allowed values are latest, 20.10, 18.10.
2392
+ # * +version+ - The version identifier. Allowed values are latest, 24.04, 20.10, 18.10.
2393
2393
  # * *Returns* - The converter object.
2394
2394
  def setConverterVersion(version)
2395
- unless /(?i)^(latest|20.10|18.10)$/.match(version)
2396
- raise Error.new(Pdfcrowd.create_invalid_value_message(version, "setConverterVersion", "html-to-pdf", "Allowed values are latest, 20.10, 18.10.", "set_converter_version"), 470);
2395
+ unless /(?i)^(latest|24.04|20.10|18.10)$/.match(version)
2396
+ raise Error.new(Pdfcrowd.create_invalid_value_message(version, "setConverterVersion", "html-to-pdf", "Allowed values are latest, 24.04, 20.10, 18.10.", "set_converter_version"), 470);
2397
2397
  end
2398
2398
 
2399
2399
  @helper.setConverterVersion(version)
@@ -3199,11 +3199,11 @@ module Pdfcrowd
3199
3199
 
3200
3200
  # Set the converter version. Different versions may produce different output. Choose which one provides the best output for your case.
3201
3201
  #
3202
- # * +version+ - The version identifier. Allowed values are latest, 20.10, 18.10.
3202
+ # * +version+ - The version identifier. Allowed values are latest, 24.04, 20.10, 18.10.
3203
3203
  # * *Returns* - The converter object.
3204
3204
  def setConverterVersion(version)
3205
- unless /(?i)^(latest|20.10|18.10)$/.match(version)
3206
- raise Error.new(Pdfcrowd.create_invalid_value_message(version, "setConverterVersion", "html-to-image", "Allowed values are latest, 20.10, 18.10.", "set_converter_version"), 470);
3205
+ unless /(?i)^(latest|24.04|20.10|18.10)$/.match(version)
3206
+ raise Error.new(Pdfcrowd.create_invalid_value_message(version, "setConverterVersion", "html-to-image", "Allowed values are latest, 24.04, 20.10, 18.10.", "set_converter_version"), 470);
3207
3207
  end
3208
3208
 
3209
3209
  @helper.setConverterVersion(version)
@@ -3807,11 +3807,11 @@ module Pdfcrowd
3807
3807
 
3808
3808
  # Set the converter version. Different versions may produce different output. Choose which one provides the best output for your case.
3809
3809
  #
3810
- # * +version+ - The version identifier. Allowed values are latest, 20.10, 18.10.
3810
+ # * +version+ - The version identifier. Allowed values are latest, 24.04, 20.10, 18.10.
3811
3811
  # * *Returns* - The converter object.
3812
3812
  def setConverterVersion(version)
3813
- unless /(?i)^(latest|20.10|18.10)$/.match(version)
3814
- raise Error.new(Pdfcrowd.create_invalid_value_message(version, "setConverterVersion", "image-to-image", "Allowed values are latest, 20.10, 18.10.", "set_converter_version"), 470);
3813
+ unless /(?i)^(latest|24.04|20.10|18.10)$/.match(version)
3814
+ raise Error.new(Pdfcrowd.create_invalid_value_message(version, "setConverterVersion", "image-to-image", "Allowed values are latest, 24.04, 20.10, 18.10.", "set_converter_version"), 470);
3815
3815
  end
3816
3816
 
3817
3817
  @helper.setConverterVersion(version)
@@ -4375,11 +4375,11 @@ module Pdfcrowd
4375
4375
 
4376
4376
  # Set the converter version. Different versions may produce different output. Choose which one provides the best output for your case.
4377
4377
  #
4378
- # * +version+ - The version identifier. Allowed values are latest, 20.10, 18.10.
4378
+ # * +version+ - The version identifier. Allowed values are latest, 24.04, 20.10, 18.10.
4379
4379
  # * *Returns* - The converter object.
4380
4380
  def setConverterVersion(version)
4381
- unless /(?i)^(latest|20.10|18.10)$/.match(version)
4382
- raise Error.new(Pdfcrowd.create_invalid_value_message(version, "setConverterVersion", "pdf-to-pdf", "Allowed values are latest, 20.10, 18.10.", "set_converter_version"), 470);
4381
+ unless /(?i)^(latest|24.04|20.10|18.10)$/.match(version)
4382
+ raise Error.new(Pdfcrowd.create_invalid_value_message(version, "setConverterVersion", "pdf-to-pdf", "Allowed values are latest, 24.04, 20.10, 18.10.", "set_converter_version"), 470);
4383
4383
  end
4384
4384
 
4385
4385
  @helper.setConverterVersion(version)
@@ -5292,11 +5292,11 @@ module Pdfcrowd
5292
5292
 
5293
5293
  # Set the converter version. Different versions may produce different output. Choose which one provides the best output for your case.
5294
5294
  #
5295
- # * +version+ - The version identifier. Allowed values are latest, 20.10, 18.10.
5295
+ # * +version+ - The version identifier. Allowed values are latest, 24.04, 20.10, 18.10.
5296
5296
  # * *Returns* - The converter object.
5297
5297
  def setConverterVersion(version)
5298
- unless /(?i)^(latest|20.10|18.10)$/.match(version)
5299
- raise Error.new(Pdfcrowd.create_invalid_value_message(version, "setConverterVersion", "image-to-pdf", "Allowed values are latest, 20.10, 18.10.", "set_converter_version"), 470);
5298
+ unless /(?i)^(latest|24.04|20.10|18.10)$/.match(version)
5299
+ raise Error.new(Pdfcrowd.create_invalid_value_message(version, "setConverterVersion", "image-to-pdf", "Allowed values are latest, 24.04, 20.10, 18.10.", "set_converter_version"), 470);
5300
5300
  end
5301
5301
 
5302
5302
  @helper.setConverterVersion(version)
@@ -6332,4 +6332,464 @@ module Pdfcrowd
6332
6332
 
6333
6333
  end
6334
6334
 
6335
+ # Conversion from PDF to image.
6336
+ class PdfToImageClient
6337
+ # Constructor for the Pdfcrowd API client.
6338
+ #
6339
+ # * +user_name+ - Your username at Pdfcrowd.
6340
+ # * +api_key+ - Your API key.
6341
+ def initialize(user_name, api_key)
6342
+ @helper = ConnectionHelper.new(user_name, api_key)
6343
+ @fields = {
6344
+ 'input_format'=>'pdf',
6345
+ 'output_format'=>'png'
6346
+ }
6347
+ @file_id = 1
6348
+ @files = {}
6349
+ @raw_data = {}
6350
+ end
6351
+
6352
+ # Convert an image.
6353
+ #
6354
+ # * +url+ - The address of the image to convert. The supported protocols are http:// and https://.
6355
+ # * *Returns* - Byte array containing the conversion output.
6356
+ def convertUrl(url)
6357
+ unless /(?i)^https?:\/\/.*$/.match(url)
6358
+ raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrl", "pdf-to-image", "The supported protocols are http:// and https://.", "convert_url"), 470);
6359
+ end
6360
+
6361
+ @fields['url'] = url
6362
+ @helper.post(@fields, @files, @raw_data)
6363
+ end
6364
+
6365
+ # Convert an image and write the result to an output stream.
6366
+ #
6367
+ # * +url+ - The address of the image to convert. The supported protocols are http:// and https://.
6368
+ # * +out_stream+ - The output stream that will contain the conversion output.
6369
+ def convertUrlToStream(url, out_stream)
6370
+ unless /(?i)^https?:\/\/.*$/.match(url)
6371
+ raise Error.new(Pdfcrowd.create_invalid_value_message(url, "convertUrlToStream::url", "pdf-to-image", "The supported protocols are http:// and https://.", "convert_url_to_stream"), 470);
6372
+ end
6373
+
6374
+ @fields['url'] = url
6375
+ @helper.post(@fields, @files, @raw_data, out_stream)
6376
+ end
6377
+
6378
+ # Convert an image and write the result to a local file.
6379
+ #
6380
+ # * +url+ - The address of the image to convert. The supported protocols are http:// and https://.
6381
+ # * +file_path+ - The output file path. The string must not be empty.
6382
+ def convertUrlToFile(url, file_path)
6383
+ if (!(!file_path.nil? && !file_path.empty?))
6384
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertUrlToFile::file_path", "pdf-to-image", "The string must not be empty.", "convert_url_to_file"), 470);
6385
+ end
6386
+
6387
+ output_file = open(file_path, "wb")
6388
+ begin
6389
+ convertUrlToStream(url, output_file)
6390
+ output_file.close()
6391
+ rescue Error => why
6392
+ output_file.close()
6393
+ FileUtils.rm(file_path)
6394
+ raise
6395
+ end
6396
+ end
6397
+
6398
+ # Convert a local file.
6399
+ #
6400
+ # * +file+ - The path to a local file to convert. The file must exist and not be empty.
6401
+ # * *Returns* - Byte array containing the conversion output.
6402
+ def convertFile(file)
6403
+ if (!(File.file?(file) && !File.zero?(file)))
6404
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file, "convertFile", "pdf-to-image", "The file must exist and not be empty.", "convert_file"), 470);
6405
+ end
6406
+
6407
+ @files['file'] = file
6408
+ @helper.post(@fields, @files, @raw_data)
6409
+ end
6410
+
6411
+ # Convert a local file and write the result to an output stream.
6412
+ #
6413
+ # * +file+ - The path to a local file to convert. The file must exist and not be empty.
6414
+ # * +out_stream+ - The output stream that will contain the conversion output.
6415
+ def convertFileToStream(file, out_stream)
6416
+ if (!(File.file?(file) && !File.zero?(file)))
6417
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file, "convertFileToStream::file", "pdf-to-image", "The file must exist and not be empty.", "convert_file_to_stream"), 470);
6418
+ end
6419
+
6420
+ @files['file'] = file
6421
+ @helper.post(@fields, @files, @raw_data, out_stream)
6422
+ end
6423
+
6424
+ # Convert a local file and write the result to a local file.
6425
+ #
6426
+ # * +file+ - The path to a local file to convert. The file must exist and not be empty.
6427
+ # * +file_path+ - The output file path. The string must not be empty.
6428
+ def convertFileToFile(file, file_path)
6429
+ if (!(!file_path.nil? && !file_path.empty?))
6430
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertFileToFile::file_path", "pdf-to-image", "The string must not be empty.", "convert_file_to_file"), 470);
6431
+ end
6432
+
6433
+ output_file = open(file_path, "wb")
6434
+ begin
6435
+ convertFileToStream(file, output_file)
6436
+ output_file.close()
6437
+ rescue Error => why
6438
+ output_file.close()
6439
+ FileUtils.rm(file_path)
6440
+ raise
6441
+ end
6442
+ end
6443
+
6444
+ # Convert raw data.
6445
+ #
6446
+ # * +data+ - The raw content to be converted.
6447
+ # * *Returns* - Byte array with the output.
6448
+ def convertRawData(data)
6449
+ @raw_data['file'] = data
6450
+ @helper.post(@fields, @files, @raw_data)
6451
+ end
6452
+
6453
+ # Convert raw data and write the result to an output stream.
6454
+ #
6455
+ # * +data+ - The raw content to be converted.
6456
+ # * +out_stream+ - The output stream that will contain the conversion output.
6457
+ def convertRawDataToStream(data, out_stream)
6458
+ @raw_data['file'] = data
6459
+ @helper.post(@fields, @files, @raw_data, out_stream)
6460
+ end
6461
+
6462
+ # Convert raw data to a file.
6463
+ #
6464
+ # * +data+ - The raw content to be converted.
6465
+ # * +file_path+ - The output file path. The string must not be empty.
6466
+ def convertRawDataToFile(data, file_path)
6467
+ if (!(!file_path.nil? && !file_path.empty?))
6468
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertRawDataToFile::file_path", "pdf-to-image", "The string must not be empty.", "convert_raw_data_to_file"), 470);
6469
+ end
6470
+
6471
+ output_file = open(file_path, "wb")
6472
+ begin
6473
+ convertRawDataToStream(data, output_file)
6474
+ output_file.close()
6475
+ rescue Error => why
6476
+ output_file.close()
6477
+ FileUtils.rm(file_path)
6478
+ raise
6479
+ end
6480
+ end
6481
+
6482
+ # Convert the contents of an input stream.
6483
+ #
6484
+ # * +in_stream+ - The input stream with source data.
6485
+ # * *Returns* - Byte array containing the conversion output.
6486
+ def convertStream(in_stream)
6487
+ @raw_data['stream'] = in_stream.read
6488
+ @helper.post(@fields, @files, @raw_data)
6489
+ end
6490
+
6491
+ # Convert the contents of an input stream and write the result to an output stream.
6492
+ #
6493
+ # * +in_stream+ - The input stream with source data.
6494
+ # * +out_stream+ - The output stream that will contain the conversion output.
6495
+ def convertStreamToStream(in_stream, out_stream)
6496
+ @raw_data['stream'] = in_stream.read
6497
+ @helper.post(@fields, @files, @raw_data, out_stream)
6498
+ end
6499
+
6500
+ # Convert the contents of an input stream and write the result to a local file.
6501
+ #
6502
+ # * +in_stream+ - The input stream with source data.
6503
+ # * +file_path+ - The output file path. The string must not be empty.
6504
+ def convertStreamToFile(in_stream, file_path)
6505
+ if (!(!file_path.nil? && !file_path.empty?))
6506
+ raise Error.new(Pdfcrowd.create_invalid_value_message(file_path, "convertStreamToFile::file_path", "pdf-to-image", "The string must not be empty.", "convert_stream_to_file"), 470);
6507
+ end
6508
+
6509
+ output_file = open(file_path, "wb")
6510
+ begin
6511
+ convertStreamToStream(in_stream, output_file)
6512
+ output_file.close()
6513
+ rescue Error => why
6514
+ output_file.close()
6515
+ FileUtils.rm(file_path)
6516
+ raise
6517
+ end
6518
+ end
6519
+
6520
+ # The format of the output file.
6521
+ #
6522
+ # * +output_format+ - Allowed values are png, jpg, gif, tiff, bmp, ico, ppm, pgm, pbm, pnm, psb, pct, ras, tga, sgi, sun, webp.
6523
+ # * *Returns* - The converter object.
6524
+ def setOutputFormat(output_format)
6525
+ unless /(?i)^(png|jpg|gif|tiff|bmp|ico|ppm|pgm|pbm|pnm|psb|pct|ras|tga|sgi|sun|webp)$/.match(output_format)
6526
+ raise Error.new(Pdfcrowd.create_invalid_value_message(output_format, "setOutputFormat", "pdf-to-image", "Allowed values are png, jpg, gif, tiff, bmp, ico, ppm, pgm, pbm, pnm, psb, pct, ras, tga, sgi, sun, webp.", "set_output_format"), 470);
6527
+ end
6528
+
6529
+ @fields['output_format'] = output_format
6530
+ self
6531
+ end
6532
+
6533
+ # Password to open the encrypted PDF file.
6534
+ #
6535
+ # * +password+ - The input PDF password.
6536
+ # * *Returns* - The converter object.
6537
+ def setPdfPassword(password)
6538
+ @fields['pdf_password'] = password
6539
+ self
6540
+ end
6541
+
6542
+ # Set the page range to print.
6543
+ #
6544
+ # * +pages+ - A comma separated list of page numbers or ranges.
6545
+ # * *Returns* - The converter object.
6546
+ def setPrintPageRange(pages)
6547
+ unless /^(?:\s*(?:\d+|(?:\d*\s*\-\s*\d+)|(?:\d+\s*\-\s*\d*))\s*,\s*)*\s*(?:\d+|(?:\d*\s*\-\s*\d+)|(?:\d+\s*\-\s*\d*))\s*$/.match(pages)
6548
+ raise Error.new(Pdfcrowd.create_invalid_value_message(pages, "setPrintPageRange", "pdf-to-image", "A comma separated list of page numbers or ranges.", "set_print_page_range"), 470);
6549
+ end
6550
+
6551
+ @fields['print_page_range'] = pages
6552
+ self
6553
+ end
6554
+
6555
+ # Set the output graphics DPI.
6556
+ #
6557
+ # * +dpi+ - The DPI value.
6558
+ # * *Returns* - The converter object.
6559
+ def setDpi(dpi)
6560
+ @fields['dpi'] = dpi
6561
+ self
6562
+ end
6563
+
6564
+ # A helper method to determine if the output file from a conversion process is a zip archive. The conversion output can be either a single image file or a zip file containing one or more image files. This method should be called after the conversion has been successfully completed.
6565
+ # * *Returns* - True if the conversion output is a zip archive, otherwise False.
6566
+ def isZippedOutput()
6567
+ @fields.fetch('force_zip', false) == true || getPageCount() > 1
6568
+ end
6569
+
6570
+ # Enforces the zip output format.
6571
+ #
6572
+ # * +value+ - Set to true to get the output as a zip archive.
6573
+ # * *Returns* - The converter object.
6574
+ def setForceZip(value)
6575
+ @fields['force_zip'] = value
6576
+ self
6577
+ end
6578
+
6579
+ # Use the crop box rather than media box.
6580
+ #
6581
+ # * +value+ - Set to true to use crop box.
6582
+ # * *Returns* - The converter object.
6583
+ def setUseCropbox(value)
6584
+ @fields['use_cropbox'] = value
6585
+ self
6586
+ end
6587
+
6588
+ # Set the top left X coordinate of the crop area in points.
6589
+ #
6590
+ # * +x+ - Must be a positive integer number or 0.
6591
+ # * *Returns* - The converter object.
6592
+ def setCropAreaX(x)
6593
+ if (!(Integer(x) >= 0))
6594
+ raise Error.new(Pdfcrowd.create_invalid_value_message(x, "setCropAreaX", "pdf-to-image", "Must be a positive integer number or 0.", "set_crop_area_x"), 470);
6595
+ end
6596
+
6597
+ @fields['crop_area_x'] = x
6598
+ self
6599
+ end
6600
+
6601
+ # Set the top left Y coordinate of the crop area in points.
6602
+ #
6603
+ # * +y+ - Must be a positive integer number or 0.
6604
+ # * *Returns* - The converter object.
6605
+ def setCropAreaY(y)
6606
+ if (!(Integer(y) >= 0))
6607
+ raise Error.new(Pdfcrowd.create_invalid_value_message(y, "setCropAreaY", "pdf-to-image", "Must be a positive integer number or 0.", "set_crop_area_y"), 470);
6608
+ end
6609
+
6610
+ @fields['crop_area_y'] = y
6611
+ self
6612
+ end
6613
+
6614
+ # Set the width of the crop area in points.
6615
+ #
6616
+ # * +width+ - Must be a positive integer number or 0.
6617
+ # * *Returns* - The converter object.
6618
+ def setCropAreaWidth(width)
6619
+ if (!(Integer(width) >= 0))
6620
+ raise Error.new(Pdfcrowd.create_invalid_value_message(width, "setCropAreaWidth", "pdf-to-image", "Must be a positive integer number or 0.", "set_crop_area_width"), 470);
6621
+ end
6622
+
6623
+ @fields['crop_area_width'] = width
6624
+ self
6625
+ end
6626
+
6627
+ # Set the height of the crop area in points.
6628
+ #
6629
+ # * +height+ - Must be a positive integer number or 0.
6630
+ # * *Returns* - The converter object.
6631
+ def setCropAreaHeight(height)
6632
+ if (!(Integer(height) >= 0))
6633
+ raise Error.new(Pdfcrowd.create_invalid_value_message(height, "setCropAreaHeight", "pdf-to-image", "Must be a positive integer number or 0.", "set_crop_area_height"), 470);
6634
+ end
6635
+
6636
+ @fields['crop_area_height'] = height
6637
+ self
6638
+ end
6639
+
6640
+ # Set the crop area. It allows to extract just a part of a PDF page.
6641
+ #
6642
+ # * +x+ - Set the top left X coordinate of the crop area in points. Must be a positive integer number or 0.
6643
+ # * +y+ - Set the top left Y coordinate of the crop area in points. Must be a positive integer number or 0.
6644
+ # * +width+ - Set the width of the crop area in points. Must be a positive integer number or 0.
6645
+ # * +height+ - Set the height of the crop area in points. Must be a positive integer number or 0.
6646
+ # * *Returns* - The converter object.
6647
+ def setCropArea(x, y, width, height)
6648
+ setCropAreaX(x)
6649
+ setCropAreaY(y)
6650
+ setCropAreaWidth(width)
6651
+ setCropAreaHeight(height)
6652
+ self
6653
+ end
6654
+
6655
+ # Generate a grayscale image.
6656
+ #
6657
+ # * +value+ - Set to true to generate a grayscale image.
6658
+ # * *Returns* - The converter object.
6659
+ def setUseGrayscale(value)
6660
+ @fields['use_grayscale'] = value
6661
+ self
6662
+ end
6663
+
6664
+ # Turn on the debug logging. Details about the conversion are stored in the debug log. The URL of the log can be obtained from the getDebugLogUrl method or available in conversion statistics.
6665
+ #
6666
+ # * +value+ - Set to true to enable the debug logging.
6667
+ # * *Returns* - The converter object.
6668
+ def setDebugLog(value)
6669
+ @fields['debug_log'] = value
6670
+ self
6671
+ end
6672
+
6673
+ # Get the URL of the debug log for the last conversion.
6674
+ # * *Returns* - The link to the debug log.
6675
+ def getDebugLogUrl()
6676
+ return @helper.getDebugLogUrl()
6677
+ end
6678
+
6679
+ # Get the number of conversion credits available in your account.
6680
+ # This method can only be called after a call to one of the convertXtoY methods.
6681
+ # The returned value can differ from the actual count if you run parallel conversions.
6682
+ # The special value 999999 is returned if the information is not available.
6683
+ # * *Returns* - The number of credits.
6684
+ def getRemainingCreditCount()
6685
+ return @helper.getRemainingCreditCount()
6686
+ end
6687
+
6688
+ # Get the number of credits consumed by the last conversion.
6689
+ # * *Returns* - The number of credits.
6690
+ def getConsumedCreditCount()
6691
+ return @helper.getConsumedCreditCount()
6692
+ end
6693
+
6694
+ # Get the job id.
6695
+ # * *Returns* - The unique job identifier.
6696
+ def getJobId()
6697
+ return @helper.getJobId()
6698
+ end
6699
+
6700
+ # Get the number of pages in the output document.
6701
+ # * *Returns* - The page count.
6702
+ def getPageCount()
6703
+ return @helper.getPageCount()
6704
+ end
6705
+
6706
+ # Get the size of the output in bytes.
6707
+ # * *Returns* - The count of bytes.
6708
+ def getOutputSize()
6709
+ return @helper.getOutputSize()
6710
+ end
6711
+
6712
+ # Get the version details.
6713
+ # * *Returns* - API version, converter version, and client version.
6714
+ def getVersion()
6715
+ return "client " + CLIENT_VERSION + ", API v2, converter " + @helper.getConverterVersion()
6716
+ end
6717
+
6718
+ # Tag the conversion with a custom value. The tag is used in conversion statistics. A value longer than 32 characters is cut off.
6719
+ #
6720
+ # * +tag+ - A string with the custom tag.
6721
+ # * *Returns* - The converter object.
6722
+ def setTag(tag)
6723
+ @fields['tag'] = tag
6724
+ self
6725
+ end
6726
+
6727
+ # A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTP scheme. It can help to circumvent regional restrictions or provide limited access to your intranet.
6728
+ #
6729
+ # * +proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
6730
+ # * *Returns* - The converter object.
6731
+ def setHttpProxy(proxy)
6732
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(proxy)
6733
+ raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, "setHttpProxy", "pdf-to-image", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_http_proxy"), 470);
6734
+ end
6735
+
6736
+ @fields['http_proxy'] = proxy
6737
+ self
6738
+ end
6739
+
6740
+ # A proxy server used by Pdfcrowd conversion process for accessing the source URLs with HTTPS scheme. It can help to circumvent regional restrictions or provide limited access to your intranet.
6741
+ #
6742
+ # * +proxy+ - The value must have format DOMAIN_OR_IP_ADDRESS:PORT.
6743
+ # * *Returns* - The converter object.
6744
+ def setHttpsProxy(proxy)
6745
+ unless /(?i)^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z0-9]{1,}:\d+$/.match(proxy)
6746
+ raise Error.new(Pdfcrowd.create_invalid_value_message(proxy, "setHttpsProxy", "pdf-to-image", "The value must have format DOMAIN_OR_IP_ADDRESS:PORT.", "set_https_proxy"), 470);
6747
+ end
6748
+
6749
+ @fields['https_proxy'] = proxy
6750
+ self
6751
+ end
6752
+
6753
+ # Specifies if the client communicates over HTTP or HTTPS with Pdfcrowd API.
6754
+ # Warning: Using HTTP is insecure as data sent over HTTP is not encrypted. Enable this option only if you know what you are doing.
6755
+ #
6756
+ # * +value+ - Set to true to use HTTP.
6757
+ # * *Returns* - The converter object.
6758
+ def setUseHttp(value)
6759
+ @helper.setUseHttp(value)
6760
+ self
6761
+ end
6762
+
6763
+ # Set a custom user agent HTTP header. It can be useful if you are behind a proxy or a firewall.
6764
+ #
6765
+ # * +agent+ - The user agent string.
6766
+ # * *Returns* - The converter object.
6767
+ def setUserAgent(agent)
6768
+ @helper.setUserAgent(agent)
6769
+ self
6770
+ end
6771
+
6772
+ # Specifies an HTTP proxy that the API client library will use to connect to the internet.
6773
+ #
6774
+ # * +host+ - The proxy hostname.
6775
+ # * +port+ - The proxy port.
6776
+ # * +user_name+ - The username.
6777
+ # * +password+ - The password.
6778
+ # * *Returns* - The converter object.
6779
+ def setProxy(host, port, user_name, password)
6780
+ @helper.setProxy(host, port, user_name, password)
6781
+ self
6782
+ end
6783
+
6784
+ # Specifies the number of automatic retries when the 502 or 503 HTTP status code is received. The status code indicates a temporary network issue. This feature can be disabled by setting to 0.
6785
+ #
6786
+ # * +count+ - Number of retries.
6787
+ # * *Returns* - The converter object.
6788
+ def setRetryCount(count)
6789
+ @helper.setRetryCount(count)
6790
+ self
6791
+ end
6792
+
6793
+ end
6794
+
6335
6795
  end
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.18.1
4
+ version: 5.20.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: 2024-03-19 00:00:00.000000000 Z
11
+ date: 2024-06-07 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.