pdfcrowd 5.1.1 → 5.2.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 +103 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ce783233a9cfb07981027de99484b52696c70ac36865066e263cb4524fc3aa8
4
- data.tar.gz: 8af414bdd2dd8822fcd83c02cf52837baa32449c46270aa19be1c2799c503ada
3
+ metadata.gz: ae09fe4d44318c3dab2a3804590c724cab4e92e0b4d96465741d01a3d3878e3d
4
+ data.tar.gz: 968307d08a48c39f21e290e5e0d1e18ec8b9284f90643617040b2c4ed525adef
5
5
  SHA512:
6
- metadata.gz: ea0a791e71eedbb2145fb754f9fb39a86583c5b5c7e4e00be87bc622a3299eca1267f1d111ee995fca6093cc5939643dda74c317aab13d067a420cf2b6e851c5
7
- data.tar.gz: 110f85f489157e5db520340ca0d7ce68a14933566dbd2be2e2d5b338b4bdeb03dad99b143fbaee388a09e4c99e00477cbe51004fcb20aa14eec30145a4d2657b
6
+ metadata.gz: 42bfe893fbf5c150376920d5550d387aac1214d62ee788a27df6429f05f91373e27ed16f4da33d6258ba5c1cc95e9b84b656cf3c02b7bf805fee4a2b62947cac
7
+ data.tar.gz: 4c6e63c4fa88abaa622701690a66b85ace7c3c62de2efed671d3098c3ee950efdd20fe6f0ac1224a201d172f98a18daeb5e065e5d5422c5b795b033eef557b15
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.1.1'
533
+ CLIENT_VERSION = '5.2.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.1.1 (https://pdfcrowd.com)')
544
+ setUserAgent('pdfcrowd_ruby_client/5.2.0 (https://pdfcrowd.com)')
545
545
 
546
546
  @retry_count = 1
547
547
  @converter_version = '20.10'
@@ -626,7 +626,7 @@ module Pdfcrowd
626
626
  body << 'Content-Disposition: form-data; name="%s"; filename="%s"' % [name, file_name]
627
627
  body << 'Content-Type: application/octet-stream'
628
628
  body << ''
629
- body << data
629
+ body << data.force_encoding('UTF-8')
630
630
  end
631
631
 
632
632
  def self.encode_multipart_post_data(fields, files, raw_data)
@@ -933,6 +933,15 @@ module Pdfcrowd
933
933
  end
934
934
  end
935
935
 
936
+ # Set the file name of the main HTML document stored in the input archive. If not specified, the first HTML file in the archive is used for conversion. Use this method if the input archive contains multiple HTML documents.
937
+ #
938
+ # * +filename+ - The file name.
939
+ # * *Returns* - The converter object.
940
+ def setZipMainFilename(filename)
941
+ @fields['zip_main_filename'] = filename
942
+ self
943
+ end
944
+
936
945
  # Set the output page size.
937
946
  #
938
947
  # * +size+ - Allowed values are A0, A1, A2, A3, A4, A5, A6, Letter.
@@ -1174,7 +1183,7 @@ module Pdfcrowd
1174
1183
  self
1175
1184
  end
1176
1185
 
1177
- # Load an HTML code from the specified URL and use it as the page header. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals Arabic numerals are used by default. Roman numerals can be generated by the roman and roman-lowercase values Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL, allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1186
+ # Load an HTML code from the specified URL and use it as the page header. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1178
1187
  #
1179
1188
  # * +url+ - The supported protocols are http:// and https://.
1180
1189
  # * *Returns* - The converter object.
@@ -1187,7 +1196,7 @@ module Pdfcrowd
1187
1196
  self
1188
1197
  end
1189
1198
 
1190
- # Use the specified HTML code as the page header. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals Arabic numerals are used by default. Roman numerals can be generated by the roman and roman-lowercase values Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL, allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1199
+ # Use the specified HTML code as the page header. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1191
1200
  #
1192
1201
  # * +html+ - The string must not be empty.
1193
1202
  # * *Returns* - The converter object.
@@ -1213,7 +1222,16 @@ module Pdfcrowd
1213
1222
  self
1214
1223
  end
1215
1224
 
1216
- # Load an HTML code from the specified URL and use it as the page footer. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals Arabic numerals are used by default. Roman numerals can be generated by the roman and roman-lowercase values Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL, allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1225
+ # Set the file name of the header HTML document stored in the input archive. Use this method if the input archive contains multiple HTML documents.
1226
+ #
1227
+ # * +filename+ - The file name.
1228
+ # * *Returns* - The converter object.
1229
+ def setZipHeaderFilename(filename)
1230
+ @fields['zip_header_filename'] = filename
1231
+ self
1232
+ end
1233
+
1234
+ # Load an HTML code from the specified URL and use it as the page footer. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1217
1235
  #
1218
1236
  # * +url+ - The supported protocols are http:// and https://.
1219
1237
  # * *Returns* - The converter object.
@@ -1226,7 +1244,7 @@ module Pdfcrowd
1226
1244
  self
1227
1245
  end
1228
1246
 
1229
- # Use the specified HTML as the page footer. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals Arabic numerals are used by default. Roman numerals can be generated by the roman and roman-lowercase values Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL, allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1247
+ # Use the specified HTML as the page footer. The following classes can be used in the HTML. The content of the respective elements will be expanded as follows: pdfcrowd-page-count - the total page count of printed pages pdfcrowd-page-number - the current page number pdfcrowd-source-url - the source URL of a converted document The following attributes can be used: data-pdfcrowd-number-format - specifies the type of the used numerals. Allowed values: arabic - Arabic numerals, they are used by default roman - Roman numerals eastern-arabic - Eastern Arabic numerals bengali - Bengali numerals devanagari - Devanagari numerals thai - Thai numerals east-asia - Chinese, Vietnamese, Japanese and Korean numerals chinese-formal - Chinese formal numerals Please contact us if you need another type of numerals. Example: <span class='pdfcrowd-page-number' data-pdfcrowd-number-format='roman'></span> data-pdfcrowd-placement - specifies where to place the source URL. Allowed values: The URL is inserted to the content Example: <span class='pdfcrowd-source-url'></span> will produce <span>http://example.com</span> href - the URL is set to the href attribute Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href'>Link to source</a> will produce <a href='http://example.com'>Link to source</a> href-and-content - the URL is set to the href attribute and to the content Example: <a class='pdfcrowd-source-url' data-pdfcrowd-placement='href-and-content'></a> will produce <a href='http://example.com'>http://example.com</a>
1230
1248
  #
1231
1249
  # * +html+ - The string must not be empty.
1232
1250
  # * *Returns* - The converter object.
@@ -1252,6 +1270,15 @@ module Pdfcrowd
1252
1270
  self
1253
1271
  end
1254
1272
 
1273
+ # Set the file name of the footer HTML document stored in the input archive. Use this method if the input archive contains multiple HTML documents.
1274
+ #
1275
+ # * +filename+ - The file name.
1276
+ # * *Returns* - The converter object.
1277
+ def setZipFooterFilename(filename)
1278
+ @fields['zip_footer_filename'] = filename
1279
+ self
1280
+ end
1281
+
1255
1282
  # Disable horizontal page margins for header and footer. The header/footer contents width will be equal to the physical page width.
1256
1283
  #
1257
1284
  # * +value+ - Set to true to disable horizontal margins for header and footer.
@@ -1641,7 +1668,7 @@ module Pdfcrowd
1641
1668
  self
1642
1669
  end
1643
1670
 
1644
- # Specify the DOM handling when only a part of the document is converted.
1671
+ # Specify the DOM handling when only a part of the document is converted. This can affect the CSS rules used.
1645
1672
  #
1646
1673
  # * +mode+ - Allowed values are cut-out, remove-siblings, hide-siblings.
1647
1674
  # * *Returns* - The converter object.
@@ -1881,6 +1908,15 @@ module Pdfcrowd
1881
1908
  self
1882
1909
  end
1883
1910
 
1911
+ # Extract meta tags (author, keywords and description) from the input HTML and use them in the output PDF.
1912
+ #
1913
+ # * +value+ - Set to true to extract meta tags.
1914
+ # * *Returns* - The converter object.
1915
+ def setExtractMetaTags(value)
1916
+ @fields['extract_meta_tags'] = value
1917
+ self
1918
+ end
1919
+
1884
1920
  # Specify the page layout to be used when the document is opened.
1885
1921
  #
1886
1922
  # * +layout+ - Allowed values are single-page, one-column, two-column-left, two-column-right.
@@ -2525,6 +2561,15 @@ module Pdfcrowd
2525
2561
  end
2526
2562
  end
2527
2563
 
2564
+ # Set the file name of the main HTML document stored in the input archive. If not specified, the first HTML file in the archive is used for conversion. Use this method if the input archive contains multiple HTML documents.
2565
+ #
2566
+ # * +filename+ - The file name.
2567
+ # * *Returns* - The converter object.
2568
+ def setZipMainFilename(filename)
2569
+ @fields['zip_main_filename'] = filename
2570
+ self
2571
+ end
2572
+
2528
2573
  # Use the print version of the page if available (@media print).
2529
2574
  #
2530
2575
  # * +value+ - Set to true to use the print version of the page.
@@ -2749,7 +2794,7 @@ module Pdfcrowd
2749
2794
  self
2750
2795
  end
2751
2796
 
2752
- # Specify the DOM handling when only a part of the document is converted.
2797
+ # Specify the DOM handling when only a part of the document is converted. This can affect the CSS rules used.
2753
2798
  #
2754
2799
  # * +mode+ - Allowed values are cut-out, remove-siblings, hide-siblings.
2755
2800
  # * *Returns* - The converter object.
@@ -3668,6 +3713,55 @@ module Pdfcrowd
3668
3713
  self
3669
3714
  end
3670
3715
 
3716
+ # Set the title of the PDF.
3717
+ #
3718
+ # * +title+ - The title.
3719
+ # * *Returns* - The converter object.
3720
+ def setTitle(title)
3721
+ @fields['title'] = title
3722
+ self
3723
+ end
3724
+
3725
+ # Set the subject of the PDF.
3726
+ #
3727
+ # * +subject+ - The subject.
3728
+ # * *Returns* - The converter object.
3729
+ def setSubject(subject)
3730
+ @fields['subject'] = subject
3731
+ self
3732
+ end
3733
+
3734
+ # Set the author of the PDF.
3735
+ #
3736
+ # * +author+ - The author.
3737
+ # * *Returns* - The converter object.
3738
+ def setAuthor(author)
3739
+ @fields['author'] = author
3740
+ self
3741
+ end
3742
+
3743
+ # Associate keywords with the document.
3744
+ #
3745
+ # * +keywords+ - The string with the keywords.
3746
+ # * *Returns* - The converter object.
3747
+ def setKeywords(keywords)
3748
+ @fields['keywords'] = keywords
3749
+ self
3750
+ end
3751
+
3752
+ # Use metadata (title, subject, author and keywords) from the n-th input PDF.
3753
+ #
3754
+ # * +index+ - Set the index of the input PDF file from which to use the metadata. 0 means no metadata. Must be a positive integer number or 0.
3755
+ # * *Returns* - The converter object.
3756
+ def setUseMetadataFrom(index)
3757
+ if (!(Integer(index) >= 0))
3758
+ raise Error.new(Pdfcrowd.create_invalid_value_message(index, "setUseMetadataFrom", "pdf-to-pdf", "Must be a positive integer number or 0.", "set_use_metadata_from"), 470);
3759
+ end
3760
+
3761
+ @fields['use_metadata_from'] = index
3762
+ self
3763
+ end
3764
+
3671
3765
  # Specify the page layout to be used when the document is opened.
3672
3766
  #
3673
3767
  # * +layout+ - Allowed values are single-page, one-column, two-column-left, two-column-right.
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.1.1
4
+ version: 5.2.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-05-12 00:00:00.000000000 Z
11
+ date: 2021-08-23 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.