dynamicpdf_api 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7606afef6a8e95caba5eb455e80d639e5677e5f8c461fa915f38dff459bddd07
4
- data.tar.gz: d9ac229a6451da9c8395f90ebc299d95771ed98150690b35db53ac67ad1bf9d4
3
+ metadata.gz: 4032069e887ac6170c27e3e62b6c53937012fc0fc532bcc1ee078db7cc699279
4
+ data.tar.gz: '079b748ab778f13fe486b969f371f563456f7ad2aaebdcea1161b04be0d01d91'
5
5
  SHA512:
6
- metadata.gz: 364f59d5200af9cd9797481f6240ed365c7541fea8d66d4387c881da919a8e13e3804011dac32959c9dee789d137c1a31da391623970b82f3901139ca04a3876
7
- data.tar.gz: 42e982b35c3650b421dac10d14b945fdd309a62f74ead5e3a68b80ca46471be0ffc6f3e16ec8b207c46c3e83d2501d96a1d07512bbe529f04bbdb9365b832998
6
+ metadata.gz: 87516c46b99ab12217f99c0997f9b64dc65f2636d3117aae776a941208bc5c758cc3a4d48e4c2b2e4b6370ace9938b6708d77365f1c9e70a54bbdb08c0c255e9
7
+ data.tar.gz: 79cec9da77a1828a018a1865caa6f6d99c5278973c191a991e4132c2ea46d4dfa5e9f20f3524d41c21da18cca25c69296b380ad76465c597eb15d95fc9f267c4
@@ -42,8 +42,9 @@ module DynamicPDFApi
42
42
  attr_accessor :image_size
43
43
 
44
44
  def initialize(resource)
45
- @resource = resource
45
+ super()
46
46
  @_endpoint_name = 'pdf-image'
47
+ @resource = resource
47
48
  end
48
49
 
49
50
  def process
@@ -170,7 +170,7 @@ module DynamicPDFApi
170
170
  #
171
171
  def add_html(html, basepath = nil, size = nil, orientation = nil, margins = nil)
172
172
  input = nil
173
- if file.is_a?(String)
173
+ if html.is_a?(String)
174
174
  input = HtmlInput.new(HtmlResource.new(html), basepath, size, orientation, margins)
175
175
  else
176
176
  input = HtmlInput.new(resource, basepath, size, orientation, margins)
@@ -1,6 +1,7 @@
1
1
  module DynamicPDFApi
2
2
  require_relative 'Endpoint'
3
3
  require_relative 'PdfTextResponse'
4
+ require_relative 'TextOrder'
4
5
 
5
6
  #
6
7
  # Represents the pdf text endpoint.
@@ -12,15 +13,15 @@ module DynamicPDFApi
12
13
  # @param resource [PdfResource] The image resource of type PdfResource.
13
14
  # @param start_page [int] The start page.
14
15
  # @param page_count [int] The page count.
16
+ # @param text_order The text extraction order.
15
17
  #
16
- def initialize(resource, start_page = 1, page_count = 0)
18
+ def initialize(resource, start_page = 1, page_count = 0, text_order = TextOrder::STREAM)
17
19
  @_endpoint_name = 'pdf-text'
18
- @start_page = 1
19
- @page_count = 0
20
20
  super()
21
21
  @resource = resource
22
22
  @start_page = start_page
23
23
  @page_count = page_count
24
+ @text_order = text_order
24
25
  end
25
26
 
26
27
  #
@@ -33,6 +34,11 @@ module DynamicPDFApi
33
34
  #
34
35
  attr_accessor :page_count
35
36
 
37
+ #
38
+ # Gets or sets the text extraction order.
39
+ #
40
+ attr_accessor :text_order
41
+
36
42
  #
37
43
  # Process the pdf resource to get pdf's text.
38
44
  # @return PdfTextResponse Returns collection of PdfTextResponse.
@@ -45,7 +51,7 @@ module DynamicPDFApi
45
51
  'Content-Type': 'application/pdf'
46
52
  }
47
53
  uri = URI.parse("#{@base_url}/v1.0/#{@_endpoint_name}")
48
- params = { 'startPage' => @start_page, 'pageCount' => @page_count }
54
+ params = { 'startPage' => @start_page, 'pageCount' => @page_count, 'textOrder' => @text_order }
49
55
  uri.query = URI.encode_www_form(params)
50
56
 
51
57
  request = Net::HTTP::Post.new(uri.request_uri, header)
@@ -10,13 +10,13 @@ module DynamicPDFApi
10
10
  #
11
11
  # @param json_content [String] The json content
12
12
  #
13
- def initialize(json_content)
14
- @content = JSON.pretty_generate(json_content).gsub('\\\\', '\\').gsub('\"', '"').gsub('\\\r', '\r').gsub('\\\n', '\n').gsub(
15
- '\\\t', '\t'
16
- )
17
- @content = @content[1..@content.length - 2]
13
+ def initialize(json_content = nil)
14
+
15
+ @content = nil
16
+ super(json_content) unless json_content.nil?
17
+
18
+ @content = JSON.parse(json_content)
18
19
 
19
- super(json_content)
20
20
  end
21
21
 
22
22
  #
@@ -6,18 +6,18 @@ module DynamicPDFApi
6
6
  #
7
7
  class Security
8
8
  def initialize(user_pwd = nil, owner_pwd = nil)
9
- @_user_password = user_pwd
10
- @_owner_password = owner_pwd
11
- @_allow_copy = nil
12
- @_allow_edit = nil
13
- @_allow_print = nil
14
- @_allow_update_annots_and_fields = nil
9
+ @user_password = user_pwd
10
+ @owner_password = owner_pwd
11
+ @allow_copy = nil
12
+ @allow_edit = nil
13
+ @allow_print = nil
14
+ @allow_update_annots_and_fields = nil
15
15
 
16
- @_allow_accessibility = nil
17
- @_allow_form_filling = nil
18
- @_allow_high_resolution_printing = nil
19
- @_allow_document_assembly = nil
20
- @_type = nil
16
+ @allow_accessibility = nil
17
+ @allow_form_filling = nil
18
+ @allow_high_resolution_printing = nil
19
+ @allow_document_assembly = nil
20
+ @type = nil
21
21
  end
22
22
 
23
23
  #
@@ -0,0 +1,21 @@
1
+ module DynamicPDFApi
2
+ #
3
+ #
4
+ # Specifies text extraction order.
5
+ #
6
+ #
7
+ class TextOrder
8
+ #
9
+ # Stream text extraction order.
10
+ #
11
+ STREAM = "Stream".freeze
12
+ #
13
+ # Visible text extraction order.
14
+ #
15
+ VISIBLE = "Visible".freeze
16
+ #
17
+ # VisibleExtraSpace text extraction order.
18
+ #
19
+ VISIBLE_EXTRA_SPACE = "VisibleExtraSpace".freeze
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyClient
4
- VERSION = "1.1.2"
4
+ VERSION = "1.2.0"
5
5
  end
data/lib/ruby_client.rb CHANGED
@@ -72,6 +72,7 @@ require_relative "ruby_client/SecurityType.rb"
72
72
  require_relative "ruby_client/SignatureFieldInformation.rb"
73
73
  require_relative "ruby_client/Template.rb"
74
74
  require_relative "ruby_client/TextFieldInformation.rb"
75
+ require_relative "ruby_client/TextOrder.rb"
75
76
  require_relative "ruby_client/TextReplace.rb"
76
77
  require_relative "ruby_client/UrlAction.rb"
77
78
  require_relative "ruby_client/UnitConverter.rb"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamicpdf_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dynamicpdf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-05 00:00:00.000000000 Z
11
+ date: 2025-05-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby Client API that uses the DynamicPDF API to create, merge, split,
14
14
  form fill, stamp, secure/encrypt PDF documents and convert word/Excel files to PDF.
@@ -159,6 +159,7 @@ files:
159
159
  - lib/ruby_client/SignatureFieldInformation.rb
160
160
  - lib/ruby_client/Template.rb
161
161
  - lib/ruby_client/TextFieldInformation.rb
162
+ - lib/ruby_client/TextOrder.rb
162
163
  - lib/ruby_client/TextReplace.rb
163
164
  - lib/ruby_client/UnitConverter.rb
164
165
  - lib/ruby_client/UrlAction.rb