combine_pdf 1.0.4 → 1.0.5

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
  SHA1:
3
- metadata.gz: a262d8592dbe90e0a4930aebadda8866b731a586
4
- data.tar.gz: fdf9a2877028b673f55d23741f8c8f59af647a4f
3
+ metadata.gz: aae99be65f85291a4eb366e78d93e015822e1dcd
4
+ data.tar.gz: b92628654f3a544d3fd54fe3b9e56c344227605c
5
5
  SHA512:
6
- metadata.gz: 763aa425d24ef58b83717123f4ef7c962d2ecd083a39275df136950872e286af49d0efbc8f8d2a2f4cf0967439848c151e587073497a8ff1a7fd9b0f9ef42d7f
7
- data.tar.gz: 1c86313e09d88a07e4a2ee43fd53ce445b784770140a6892854d8f50d9dff9140c5fd993ae4d50b54ffa12f0cea6fb706a1026e18304185ccdedae3ceee0fbcb
6
+ metadata.gz: ac30f12f96a4bd58e1290859713f88917639f1ff92ba3d14ab72cfdfbdd70655727cd30a1082374fdf43e0fc8f1f502323a8b35c8f37d8a059a89baf096fb221
7
+ data.tar.gz: 4e2d3f8609b1f531c95c1e28af217eaf6e93a9a112ee96e2678d562ccb7bc895b5629b56fb90e6631a891ae1fed45985ab6cafab2ec999d52a3c1e7bbfbd11e4
@@ -2,6 +2,18 @@
2
2
 
3
3
  ***
4
4
 
5
+ #### Change log v.1.0.5
6
+
7
+ **Fix**: Fix issue #116 where some PDF objects (the page catalog and some root information data) were written twice to the saved PDF file (or String). Credit to @albertsaave for exposing the issue using GhostScript.
8
+
9
+ ***
10
+
11
+ #### Change log v.1.0.4
12
+
13
+ **Fix**: Fix issue #115 where PDF object versioning was being assumed to update the `indirect generation number`, allowing Object Streams to be inflated at the end of the parsed data collection instead of the middle. Fixed the issue by pre-emptive object deletion and by inflating Object Streams in place. Credit to @joshirashmics for exposing the issue.
14
+
15
+ ***
16
+
5
17
  #### Change log v.1.0.3
6
18
 
7
19
  **Fix**: Fix issue #111 where some fonts would cause `pdf.fonts` to break the PDF. Credit to Pavel Slabý (@paulslaby) for exposing the issue.
@@ -16,16 +16,18 @@ module CombinePDF
16
16
  # @private
17
17
  # Some PDF objects contain references to other PDF objects.
18
18
  #
19
- # this function adds the references contained in `@objects`.
19
+ # this function adds the references contained in these objects.
20
20
  #
21
21
  # this is used for internal operations, such as injectng data using the << operator.
22
- def add_referenced(should_resolve = [])
22
+ def add_referenced()
23
23
  # add references but not root
24
24
  dup_pages = nil
25
25
  # an existing object map
26
26
  resolved = {}.dup
27
27
  existing = {}.dup
28
- @objects.each { |obj| existing[obj] = obj }
28
+ should_resolve = [].dup
29
+ #set all existing objects as resolved and register their children for future resolution
30
+ @objects.each { |obj| existing[obj] = obj ; resolved[obj.object_id] = obj; should_resolve << obj.values}
29
31
  # loop until should_resolve is empty
30
32
  while should_resolve.any?
31
33
  obj = should_resolve.pop
@@ -112,7 +114,7 @@ module CombinePDF
112
114
  # inject new catalog and pages objects
113
115
  @objects << @info if @info
114
116
  @objects << catalog_object
115
- @objects << pages_object
117
+ # @objects << pages_object
116
118
 
117
119
  # rebuild/rename the forms dictionary
118
120
  if @forms_data.nil? || @forms_data.empty?
@@ -156,8 +158,7 @@ module CombinePDF
156
158
  catalog = rebuild_catalog
157
159
  page_objects = catalog[:Pages][:referenced_object][:Kids].map { |e| @objects << e[:referenced_object]; e[:referenced_object] }
158
160
  # adds every referenced object to the @objects (root), addition is performed as pointers rather then copies
159
- # add_referenced([page_objects, @forms_data, @names, @outlines, @info])
160
- add_referenced(@objects.dup)
161
+ add_referenced()
161
162
  catalog
162
163
  end
163
164
 
@@ -345,6 +346,7 @@ module CombinePDF
345
346
 
346
347
  def equal_layers obj1, obj2, layer = 3
347
348
  return true if(layer == 0)
349
+ return true if obj1.object_id == obj2.object_id
348
350
  if obj1.is_a? Hash
349
351
  return false unless obj2.is_a? Hash
350
352
  keys = obj1.keys;
@@ -1,3 +1,3 @@
1
1
  module CombinePDF
2
- VERSION = '1.0.4'.freeze
2
+ VERSION = '1.0.5'.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: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-07 00:00:00.000000000 Z
11
+ date: 2017-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-rc4