combine_pdf 0.2.32 → 0.2.33

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 965be3f2286760e04ed715a9514a1205b27aaf3e
4
- data.tar.gz: ee3098114904a30410990bd6bd0b715aae32f81d
3
+ metadata.gz: fc3b58971778d716ab9693eb7198523eff597e6a
4
+ data.tar.gz: 33bfb23329e6f0ba2917bd1eb5c120c401fe91a6
5
5
  SHA512:
6
- metadata.gz: c55779f6471f54dfd815b61dc77f62d92774f7d5dd29877af2806c7c6de5ef9eb224f8ec6b97f1f535d020227fc4026ce058098e634f974bf631ea244a622af8
7
- data.tar.gz: 9c352999dc4fa5c694e6a14f1a6ab9b02b9615af55c8991915d89283ddfad416ff0c8b5f6efe4b19df165718b37b01a138aeac21f0d693dc491426af0e4f59cf
6
+ metadata.gz: f314e20def37c16e4cdf35375cf214a5785ca3ab5b8a3ca07a8096f12d7601f1d0e5a4319ca7b4c0649dc488c668361a92058d4866aab54170d12b9ba4b8cd2b
7
+ data.tar.gz: b688dc96f6de9d79028170efdb26341bd45d2a947389b250b3795513946756267b00b4bcbbe0e41fa002881f0605f228a5d5048cf928c2655c7dca16d051ce65
@@ -2,7 +2,17 @@
2
2
 
3
3
  ***
4
4
 
5
- Change log v.0.2.32 (un-released)
5
+ Change log v.0.2.33
6
+
7
+ **Update**: Fix #97 to allow javascript support for interactive objects. Credit to @joshirashmics for exposing the issue.
8
+
9
+ **Update**: Extended "named tree" support now preserves some advanced PDF feature that weren't supported before.
10
+
11
+ **Deprecation**: Ruby is deprecating `Fixnum`, as so is CombinePDF... replaced all `Fixnum` occurrences with `Integer`.
12
+
13
+ ***
14
+
15
+ Change log v.0.2.32
6
16
 
7
17
  **Update**: Better errors when encryption related exceptions occur. Credit to Paul Shumeika ( @pshumeika ).
8
18
 
@@ -172,7 +172,7 @@ module CombinePDF
172
172
  # - :"Courier-BoldOblique"
173
173
  # - :Symbol
174
174
  # - :ZapfDingbats
175
- # font_size:: a Fixnum for the font size, or :fit_text to fit the text in the box. defaults to ":fit_text"
175
+ # font_size:: an Integer for the font size, or :fit_text to fit the text in the box. defaults to ":fit_text"
176
176
  # max_font_size:: if font_size is set to :fit_text, this will be the maximum font size. defaults to nil (no maximum)
177
177
  # font_color:: text color in [R, G, B], an array with three floats, each in a value between 0 to 1 (gray will be "[0.5, 0.5, 0.5]"). defaults to black.
178
178
  # stroke_color:: text stroke color in [R, G, B], an array with three floats, each in a value between 0 to 1 (gray will be "[0.5, 0.5, 0.5]"). defounlts to nil (no stroke).
@@ -29,7 +29,7 @@ module CombinePDF
29
29
  # the info and root objects, as found (if found) in the PDF file.
30
30
  #
31
31
  # they are mainly to used to know if the file is (was) encrypted and to get more details.
32
- attr_reader :info_object, :root_object, :names_object, :forms_object, :outlines_object
32
+ attr_reader :info_object, :root_object, :names_object, :forms_object, :outlines_object, :metadata
33
33
 
34
34
  attr_reader :allow_optional_content
35
35
  # when creating a parser, it is important to set the data (String) we wish to parse.
@@ -50,6 +50,7 @@ module CombinePDF
50
50
  @names_object = {}.dup
51
51
  @outlines_object = {}.dup
52
52
  @forms_object = {}.dup
53
+ @metadata = nil
53
54
  @strings_dictionary = {}.dup # all strings are one string
54
55
  @version = nil
55
56
  @scanner = nil
@@ -106,7 +107,7 @@ module CombinePDF
106
107
  @scanner = StringScanner.new o[:raw_stream_content]
107
108
  stream_data = _parse_
108
109
  id_array = []
109
- while stream_data[0].is_a? Fixnum
110
+ while stream_data[0].is_a? (Integer)
110
111
  id_array << stream_data.shift
111
112
  stream_data.shift
112
113
  end
@@ -221,7 +222,7 @@ module CombinePDF
221
222
  out << { indirect_without_dictionary: out.pop, indirect_generation_number: out.pop, indirect_reference_id: out.pop }
222
223
  end
223
224
  fresh = true
224
- # puts "!!!!!!!!! Error with :indirect_reference_id\n\nObject #{out.last} :indirect_reference_id = #{out.last[:indirect_reference_id]}" unless out.last[:indirect_reference_id].is_a?(Fixnum)
225
+ # puts "!!!!!!!!! Error with :indirect_reference_id\n\nObject #{out.last} :indirect_reference_id = #{out.last[:indirect_reference_id]}" unless out.last[:indirect_reference_id].is_a?(Integer)
225
226
  ##########################################
226
227
  ## parse a Hex String
227
228
  ##########################################
@@ -73,7 +73,7 @@ module CombinePDF
73
73
 
74
74
  # duplicate any non-unique pages - This is a special case to resolve Adobe Acrobat Reader issues (see issues #19 and #81)
75
75
  uniqueness = {}.dup
76
- page_list.each { |page| page = page.dup if uniqueness[page.object_id]; uniqueness[page.object_id] = page }
76
+ page_list.each { |page| page = page[:referenced_object] || page; page = page.dup if uniqueness[page.object_id]; uniqueness[page.object_id] = page }
77
77
  page_list.clear
78
78
  page_list = uniqueness.values
79
79
  uniqueness.clear
@@ -174,7 +174,7 @@ module CombinePDF
174
174
  @objects.each { |obj| obj.delete(:indirect_reference_id); obj.delete(:indirect_generation_number) }
175
175
  end
176
176
 
177
- POSSIBLE_NAME_TREES = [:Dests, :AP, :Pages, :IDS, :Templates, :URLS, :Pages].to_set.freeze
177
+ POSSIBLE_NAME_TREES = [:Dests, :AP, :Pages, :IDS, :Templates, :URLS, :JavaScript, :EmbeddedFiles, :AlternatePresentations, :Renditions].to_set.freeze
178
178
 
179
179
  def rebuild_names(name_tree = nil, base = 'CombinePDF_0000000')
180
180
  if name_tree
@@ -351,7 +351,7 @@ module CombinePDF
351
351
  # options:: a Hash of options setting the behavior and format of the page numbers:
352
352
  # - :number_format a string representing the format for page number. defaults to ' - %s - ' (allows for letter numbering as well, such as "a", "b"...).
353
353
  # - :location an Array containing the location for the page numbers, can be :top, :buttom, :top_left, :top_right, :bottom_left, :bottom_right or :center (:center == full page). defaults to [:top, :buttom].
354
- # - :start_at a Fixnum that sets the number for first page number. also accepts a letter ("a") for letter numbering. defaults to 1.
354
+ # - :start_at an Integer that sets the number for first page number. also accepts a letter ("a") for letter numbering. defaults to 1.
355
355
  # - :margin_from_height a number (PDF points) for the top and buttom margins. defaults to 45.
356
356
  # - :margin_from_side a number (PDF points) for the left and right margins. defaults to 15.
357
357
  # - :page_range a range of pages to be numbered (i.e. (2..-1) ) defaults to all the pages (nil). Remember to set the :start_at to the correct value.
@@ -20,7 +20,7 @@ module CombinePDF
20
20
  return format_name_to_pdf object
21
21
  elsif object.is_a?(Array)
22
22
  return format_array_to_pdf object
23
- elsif object.is_a?(Fixnum) || object.is_a?(Float) || object.is_a?(TrueClass) || object.is_a?(FalseClass)
23
+ elsif object.is_a?(Integer) || object.is_a?(Float) || object.is_a?(TrueClass) || object.is_a?(FalseClass)
24
24
  return object.to_s
25
25
  elsif object.is_a?(Hash)
26
26
  return format_hash_to_pdf object
@@ -154,7 +154,7 @@ module CombinePDF
154
154
  elsif object.is_a?(String)
155
155
  return object.dup
156
156
  else
157
- return object # objects that aren't Strings, Arrays or Hashes (such as Symbols and Fixnums) won't be edited inplace.
157
+ return object # objects that aren't Strings, Arrays or Hashes (such as Symbols and Integers) won't be edited inplace.
158
158
  end
159
159
  end
160
160
  end
@@ -169,5 +169,5 @@ end
169
169
  # arrays are Array
170
170
  # strings are String
171
171
  # names are Symbols (String.to_sym)
172
- # numbers are Fixnum or Float
172
+ # numbers are Integers or Float
173
173
  # boolean are TrueClass or FalseClass
@@ -1,3 +1,3 @@
1
1
  module CombinePDF
2
- VERSION = '0.2.32'.freeze
2
+ VERSION = '0.2.33'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: combine_pdf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.32
4
+ version: 0.2.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-24 00:00:00.000000000 Z
11
+ date: 2017-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-rc4
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project:
107
- rubygems_version: 2.5.2
107
+ rubygems_version: 2.6.8
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: Combine, stamp and watermark PDF files in pure Ruby.