combine_pdf 1.0.24 → 1.0.25

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
  SHA256:
3
- metadata.gz: e4c508088d852d177d9e360d9c9b2327d4964e3126ceb61c8e652788bf0e2ffb
4
- data.tar.gz: 0451512bbe0f7b61bbb2154fda45542e088bc1cee4bb905654ffde17cc196243
3
+ metadata.gz: 54586af58c21708b23e6c368b9a0841b4363ebd8113103d9d37deb045032485f
4
+ data.tar.gz: 121335c835d1902872e6b53de3b8bfc798dce9c83c0fdfaa0927c47e2771d0cc
5
5
  SHA512:
6
- metadata.gz: f1eb1830a1cca67729c8b4161df3aabcd23b5cd993d9392051aeb6f93b5ac129dbd4e37c37ff3513cc426fa4bbca6682c9954f18f51f090f9b47da775ce0847f
7
- data.tar.gz: ef9a12eb9eb0314973a3e76b6d69cb01bf2c0ee9d05e876824e88b657a771b00839a147d7d98e77f18a1d5f81196c92528958d2ac6b18f3b6cc9423d47d35c53
6
+ metadata.gz: a52629b113303a5df9000ac65d33fa5d7843ee74d8977ee7005ae43a476e63917fb462265915b25f8b5b7c6e902cf9a0f4d36f504dbc47651015c058b322c96b
7
+ data.tar.gz: 6fb00ab0f0ad9e482a850402e83183e9c1fbc0603093d069930a42ba51d704a4cad5cfb8086a27123cbe06f8b735dade401dc014b843b542cb8b1f84d0a680e0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ #### Change log v.1.0.25 (2023-12-19)
4
+
5
+ **Fix**: possible improve memory usage. Credit to @denislavski (Denislav Naydenov) for opening PR #223 and suggesting this change.
6
+
3
7
  #### Change log v.1.0.24 (2023-10-19)
4
8
 
5
9
  **Fix**: possible `nil` in loop. Credit to @jkowens for PR #231 and adding a quick fix using a simple guard.
@@ -206,9 +206,9 @@ module CombinePDF
206
206
  xref_location = loc
207
207
  # xref_location = 0
208
208
  # out.each { |line| xref_location += line.bytesize + 1}
209
- out << "xref\n0 #{indirect_object_count}\n0000000000 65535 f \n"
210
- xref.each { |offset| out << (out.pop + ("%010d 00000 n \n" % offset)) }
211
- out << out.pop + 'trailer'
209
+ out << "xref\n0 #{indirect_object_count}\n0000000000 65535 f "
210
+ xref.each { |offset| out << ("%010d 00000 n " % offset) }
211
+ out << 'trailer'.freeze
212
212
  out << "<<\n/Root #{false || "#{catalog[:indirect_reference_id]} #{catalog[:indirect_generation_number]} R"}"
213
213
  out << "/Size #{indirect_object_count}"
214
214
  out << "/Info #{@info[:indirect_reference_id]} #{@info[:indirect_generation_number]} R"
@@ -1,3 +1,3 @@
1
1
  module CombinePDF
2
- VERSION = '1.0.24'.freeze
2
+ VERSION = '1.0.25'.freeze
3
3
  end
data/test/automated CHANGED
@@ -16,51 +16,51 @@ require 'combine_pdf'
16
16
  # Pry.start
17
17
 
18
18
  pdf = CombinePDF.load "../../test\ pdfs/filled_form.pdf"
19
- pdf.save '01_check_radio_buttuns.pdf'
19
+ pdf.save '../tmp/01_check_radio_buttuns.pdf'
20
20
  pdf = CombinePDF.load "../../test\ pdfs/filled_form.pdf"
21
21
  pdf << CombinePDF.load("../../test\ pdfs/empty_form.pdf")
22
22
  pdf << CombinePDF.load("../../test\ pdfs/filled_form.pdf")
23
- pdf.save '02_check_form_unification_middle_is_empty.pdf'
23
+ pdf.save '../tmp/02_check_form_unification_middle_is_empty.pdf'
24
24
 
25
25
  pdf = CombinePDF.load "../../test\ pdfs/check_form_data__objstreams_w_versions.pdf"
26
- pdf.save '02_01_check_form_data_ordering_issue.pdf'
26
+ pdf.save '../tmp/02_01_check_form_data_ordering_issue.pdf'
27
27
 
28
28
 
29
29
  pdf = CombinePDF.load '../../test pdfs/share-font-background.pdf'
30
30
  pdf2 = CombinePDF.load '../../test pdfs/share-font-foreground.pdf'
31
31
  i = 0
32
32
  pdf.pages.each { |pg| pg << pdf2.pages[i] }
33
- pdf.save '03_check_font_conflict.pdf'
33
+ pdf.save '../tmp/03_check_font_conflict.pdf'
34
34
 
35
35
  pdf = CombinePDF.load '../../test pdfs/nil_1.pdf'
36
36
  pdf2 = CombinePDF.load '../../test pdfs/nil_2.pdf'
37
37
  pdf << pdf2
38
- pdf.save '03_01_nil_value_conflict.pdf'
38
+ pdf.save '../tmp/03_01_nil_value_conflict.pdf'
39
39
 
40
40
  pdf = CombinePDF.load '../../test pdfs/space_after_streram_keyword.pdf'
41
- pdf.save '03_02_extra_space_after_stream_keyword.pdf'
41
+ pdf.save '../tmp/03_02_extra_space_after_stream_keyword.pdf'
42
42
 
43
43
  pdf = CombinePDF.load '../../test pdfs/nested_difference.pdf'
44
- pdf.save '03_03_nested_difference.pdf'
44
+ pdf.save '../tmp/03_03_nested_difference.pdf'
45
45
 
46
46
  pdf = CombinePDF.load '../../test pdfs/names_go_haywire_0.pdf'
47
47
  pdf << CombinePDF.load('../../test pdfs/names_go_haywire_1.pdf')
48
- pdf.save '04_check_view_and_names_reference.pdf'
48
+ pdf.save '../tmp/04_check_view_and_names_reference.pdf'
49
49
 
50
50
  pdf = CombinePDF.load('../../test pdfs/outlines/self_merge_err.pdf')
51
- pdf.save '05_x1_scribus_test.pdf'
51
+ pdf.save '../tmp/05_x1_scribus_test.pdf'
52
52
  pdf = CombinePDF.load('../../test pdfs/outlines/self_merge_err.pdf')
53
53
  pdf << CombinePDF.load('../../test pdfs/outlines/self_merge_err.pdf')
54
- pdf.save '05_x2_scribus_test.pdf'
54
+ pdf.save '../tmp/05_x2_scribus_test.pdf'
55
55
  pdf = CombinePDF.load "../../test pdfs/outlines/named_dest.pdf";nil
56
- pdf.save '05_check_named_dest_links.pdf' # this will take a while
56
+ pdf.save '../tmp/05_check_named_dest_links.pdf' # this will take a while
57
57
  pdf = CombinePDF.load "../../test pdfs/outlines/named_dest.pdf";nil
58
58
  pdf << CombinePDF.load('../../test pdfs/outlines/named_dest.pdf'); nil
59
- pdf.save '05_1_timeless_check_named_dest_links.pdf' # never ends... :-(
59
+ pdf.save '../tmp/05_1_timeless_check_named_dest_links.pdf' # never ends... :-(
60
60
 
61
61
  pdf = CombinePDF.load '../../test pdfs/outline_small.pdf'
62
62
  pdf << CombinePDF.load('../../test pdfs/outline_small.pdf')
63
- pdf.save '06_check_links_to_second_copy.pdf'
63
+ pdf.save '../tmp/06_check_links_to_second_copy.pdf'
64
64
 
65
65
  lists = %w(../../test\ pdfs/outlines/self_merge_err.pdf ../../test\ pdfs/outlines/big_toc.pdf ../../test\ pdfs/outlines/bigger_toc.pdf ../../test\ pdfs/outlines/named_dest_no_toc.pdf ../../test\ pdfs/outlines/named_dest_no_toc2.pdf ../../test\ pdfs/outlines/named_dest.pdf ../../test\ pdfs/outlines/named_dest2.pdf)
66
66
 
@@ -77,7 +77,7 @@ lists.each do |n|
77
77
  end
78
78
  pdf = CombinePDF.new
79
79
  lists.each { |n| pdf << CombinePDF.load(n) }
80
- pdf.save('07_named destinations.pdf')
80
+ pdf.save('../tmp/07_named destinations.pdf')
81
81
 
82
82
  pdf = CombinePDF.new
83
83
  lists.each { |n| pdf << CombinePDF.load(n) }
@@ -91,15 +91,15 @@ pdf.number_pages(start_at: 1,
91
91
  number_location: [:top, :bottom],
92
92
  opacity: 0.75)
93
93
 
94
- pdf.save('07_named destinations_numbered.pdf')
94
+ pdf.save('../tmp/07_named destinations_numbered.pdf')
95
95
 
96
- CombinePDF.load("../../test\ pdfs/Scribus-unknown_err.pdf").save '08_1-unknown-err-empty-str.pdf'
97
- CombinePDF.load("../../test\ pdfs/Scribus-unknown_err2.pdf").save '08_2-unknown-err-empty-str.pdf'
98
- CombinePDF.load("../../test\ pdfs/Scribus-unknown_err3.pdf").save '08_3-unknown-err-empty-str.pdf'
99
- CombinePDF.load("../../test\ pdfs/xref_in_middle.pdf").save '08_4-xref-in-middle.pdf'
100
- CombinePDF.load("../../test\ pdfs/xref_split.pdf").save '08_5-xref-fragmented.pdf'
96
+ CombinePDF.load("../../test\ pdfs/Scribus-unknown_err.pdf").save '../tmp/08_1-unknown-err-empty-str.pdf'
97
+ CombinePDF.load("../../test\ pdfs/Scribus-unknown_err2.pdf").save '../tmp/08_2-unknown-err-empty-str.pdf'
98
+ CombinePDF.load("../../test\ pdfs/Scribus-unknown_err3.pdf").save '../tmp/08_3-unknown-err-empty-str.pdf'
99
+ CombinePDF.load("../../test\ pdfs/xref_in_middle.pdf").save '../tmp/08_4-xref-in-middle.pdf'
100
+ CombinePDF.load("../../test\ pdfs/xref_split.pdf").save '../tmp/08_5-xref-fragmented.pdf'
101
101
 
102
- CombinePDF.load("../../test\ pdfs/nil_object.pdf").save('09_nil_in_parsed_array.pdf')
102
+ CombinePDF.load("../../test\ pdfs/nil_object.pdf").save('../tmp/09_nil_in_parsed_array.pdf')
103
103
 
104
104
  encrypted = [ "../../test\ pdfs/pdf-reader/encrypted_version4_revision4_128bit_aes_user_pass_apples_enc_metadata.pdf",
105
105
  "../../test\ pdfs/AESv2\ encrypted.pdf",
@@ -110,7 +110,7 @@ encrypted = [ "../../test\ pdfs/pdf-reader/encrypted_version4_revision4_128bit_a
110
110
  encrypted.length.times do |i|
111
111
  fname = File.basename encrypted[i]
112
112
  begin
113
- CombinePDF.load(encrypted[i]).save "10_#{i}_#{fname}"
113
+ CombinePDF.load(encrypted[i]).save "../tmp/10_#{i}_#{fname}"
114
114
  rescue => e
115
115
  puts e.class.name, e.message
116
116
  if(i == 0)
@@ -126,10 +126,10 @@ IO.binwrite '11_prawn.pdf', (Prawn::Document.new { text 'Hello World!' }).render
126
126
  page = CombinePDF.parse((Prawn::Document.new { text 'Hello World!' }).render)
127
127
  pdf = CombinePDF.new
128
128
  pdf << page
129
- pdf.save '11_parsed_from_prawn.pdf'
129
+ pdf.save '../tmp/11_parsed_from_prawn.pdf'
130
130
  pdf = CombinePDF.new
131
131
  pdf << page << page
132
- pdf.save('11_AcrobatReader_is_unique_page.pdf')
132
+ pdf.save('../tmp/11_AcrobatReader_is_unique_page.pdf')
133
133
 
134
134
  puts GC.stat.inspect
135
135
  # unify = [
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.24
4
+ version: 1.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boaz Segev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-19 00:00:00.000000000 Z
11
+ date: 2023-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-rc4