combine_pdf 0.1.17 → 0.1.18

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: e47677b33c3ffe86a4925b1deb037548461129b4
4
- data.tar.gz: 90a8ad24ec4a577591cbe3db7212361579c6cab6
3
+ metadata.gz: 163fdfa7125d90db5036ce74771d1c35b7646bb9
4
+ data.tar.gz: 6aa28d4851428dcf7bad4953584df22dcf80ed11
5
5
  SHA512:
6
- metadata.gz: f3abdab8d627943a9183016b6dfcad5e661d6f1fb054538549714b18f45945c32fe6fd36e6c711b435db7bc1f534bf262cf321f0fb8c73d2fa9a0392910235c0
7
- data.tar.gz: 93d3401a065522a276e22e5049e7b4c469e02de8fc3708f02783a0605d7f7ccc1bf1ac3e41e100951c384da809be04df41e259cadcd31dc52c2ef3c92b9d7509
6
+ metadata.gz: c6908ad43c44cad0e96244f901fa07559a2ce81972e23f3f0b2942086f79cdf9f6de9ba55100920d1cd4729cae0001f8e2cae4385e86bd25b6beea7bb7ae72b5
7
+ data.tar.gz: 58cdd816035416b8d2dd9ff7e80fdbda593cf7a073da336c2fc31aafb69769424411124b74ef09290a7f3da20ceb24f7b1de8593e38ec6e4185e2a79243e9352
@@ -2,13 +2,19 @@
2
2
 
3
3
  ***
4
4
 
5
+ Change log v.0.1.18
6
+
7
+ **fix**: Thank to Stefan, who reported issue #15 , we discovered that in some cases PDF files presented the wrong PDF standard version, causing an error while attempting to parse their data. The issue has been fixed by allowing the parser to search for PDF Object Streams even when the PDF file claims a PDF version below 1.5.
8
+
9
+ ***
10
+
5
11
  Change log v.0.1.17
6
12
 
7
13
  **feature**: Although it was possible to create and add empty PDF pages (at any location), it is now even easier with one method call to add empty pages at the end of a PDF object. It's also possible to add text to these empty pages or stamp them with different content.
8
14
 
9
15
  **fix?**: a possible multi-threading issue might have existed where to threads saving PDF data at the same time might corrupt PDF data (although this theoretical issue was never reported and probably never encountered). The PDF streams should now be a bit more thread safe, as long as no two threads attempt to render the same PDF object at the same time.
10
16
 
11
- **fix?**: Thank to Roma, who reported issue #14, we are now working on a fix of a mysterious issue with textboxes which could effect page numbering and textboxes on certain PDF files. It is unknown at this time if the issue is resolved and the fix is awaiting confirmation. The issue effected only some PDF files and not others.
17
+ **fix**: Thank to Georg, who reported issue #14 , we are now working on a fix of a mysterious issue with textboxes which could effect page numbering and textboxes on certain PDF files. It is unknown at this time if the issue is resolved and the fix is awaiting confirmation. The issue effected only some PDF files and not others.
12
18
 
13
19
  ***
14
20
 
@@ -74,44 +74,44 @@ module CombinePDF
74
74
  end
75
75
  end
76
76
  raise "root is unknown - cannot determine if file is Encrypted" if @root_object == {}
77
- PDFOperations.change_references_to_actual_values @parsed, @root_object
78
77
 
79
78
  if @root_object[:Encrypt]
79
+ PDFOperations.change_references_to_actual_values @parsed, @root_object
80
80
  warn "PDF is Encrypted! Attempting to unencrypt - not yet fully supported."
81
81
  decryptor = PDFDecrypt.new @parsed, @root_object
82
82
  decryptor.decrypt
83
83
  #do we really need to apply to @parsed? No, there is no need.
84
84
  end
85
- if @version >= 1.5 # code placement for object streams
86
- ## search for objects streams
87
- object_streams = @parsed.select {|obj| obj.is_a?(Hash) && obj[:Type] == :ObjStm}
88
- unless object_streams.empty?
89
- warn "PDF 1.5 Object streams found - they are not fully supported! attempting to extract objects."
90
-
91
- object_streams.each do |o|
92
- ## un-encode (using the correct filter) the object streams
93
- PDFFilter.inflate_object o
94
- ## extract objects from stream to top level arry @parsed
95
- @scanner = StringScanner.new o[:raw_stream_content]
96
- stream_data = _parse_
97
- id_array = []
98
- while stream_data[0].is_a? Fixnum
99
- id_array << stream_data.shift
100
- stream_data.shift
101
- end
102
- while id_array[0] && stream_data[0]
103
- stream_data[0] = {indirect_without_dictionary: stream_data[0]} unless stream_data[0].is_a?(Hash)
104
- stream_data[0][:indirect_reference_id] = id_array.shift
105
- stream_data[0][:indirect_generation_number] = 0
106
- @parsed << stream_data.shift
107
- end
85
+
86
+ ## search for objects streams
87
+ object_streams = @parsed.select {|obj| obj.is_a?(Hash) && obj[:Type] == :ObjStm}
88
+ unless object_streams.empty?
89
+ warn "PDF 1.5 Object streams found - they are not fully supported! attempting to extract objects."
90
+
91
+ object_streams.each do |o|
92
+ ## un-encode (using the correct filter) the object streams
93
+ PDFFilter.inflate_object o
94
+ ## extract objects from stream to top level arry @parsed
95
+ @scanner = StringScanner.new o[:raw_stream_content]
96
+ stream_data = _parse_
97
+ id_array = []
98
+ while stream_data[0].is_a? Fixnum
99
+ id_array << stream_data.shift
100
+ stream_data.shift
101
+ end
102
+ while id_array[0] && stream_data[0]
103
+ stream_data[0] = {indirect_without_dictionary: stream_data[0]} unless stream_data[0].is_a?(Hash)
104
+ stream_data[0][:indirect_reference_id] = id_array.shift
105
+ stream_data[0][:indirect_generation_number] = 0
106
+ @parsed << stream_data.shift
108
107
  end
109
- # ## remove object streams
110
- @parsed.reject! {|obj| object_streams << obj if obj.is_a?(Hash) && obj[:Type] == :ObjStm}
111
- # ## remove XREF dictionaries
112
- @parsed.reject! {|obj| object_streams << obj if obj.is_a?(Hash) && obj[:Type] == :XRef}
113
108
  end
109
+ # ## remove object streams
110
+ @parsed.reject! {|obj| object_streams << obj if obj.is_a?(Hash) && obj[:Type] == :ObjStm}
111
+ # ## remove XREF dictionaries
112
+ @parsed.reject! {|obj| object_streams << obj if obj.is_a?(Hash) && obj[:Type] == :XRef}
114
113
  end
114
+
115
115
  PDFOperations.change_references_to_actual_values @parsed, @root_object
116
116
  @info_object = @root_object[:Info]
117
117
  if @info_object && @info_object.is_a?(Hash)
@@ -1,3 +1,3 @@
1
1
  module CombinePDF
2
- VERSION = "0.1.17"
2
+ VERSION = "0.1.18"
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.1.17
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-23 00:00:00.000000000 Z
11
+ date: 2015-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-rc4
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubyforge_project:
102
- rubygems_version: 2.4.5
102
+ rubygems_version: 2.4.6
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Combine, stamp and watermark PDF files in pure Ruby.