combine_pdf 0.2.27 → 0.2.28
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +14 -7
- data/lib/combine_pdf/page_methods.rb +32 -11
- data/lib/combine_pdf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e665b1407b7f024cb4677c9e5152f7204f3a141
|
4
|
+
data.tar.gz: f77b60319109b23185cd6679a7225eb9e9db1ae7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ca99906c7a250a9f23c65756b926b563d5b96df53c1532bbcd31925bcf7feda251b51c71dbbba71ce1a0685ec4787d6ad107b290a2f6367bc7d17e37dc37a99
|
7
|
+
data.tar.gz: 8b57956404ed802515dfac20b28e8f104e27475d7672c53e4681e1522fd013962cfb1e0f0ecd676a5a1eeac396c3837d26d5bcf933f7f508ba5d40f9e55382a7
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
***
|
4
4
|
|
5
|
+
Change log v.0.2.28
|
6
|
+
|
7
|
+
**Fix**: Fixed an issue related to page stumping, which was introduced when the Rubocop beautification changed the logic of an `if` statement in the Resource merger. Credit to Leon Miller-Out (@sbleon) for noticing the issue, testing and opening PR #76.
|
8
|
+
|
9
|
+
***
|
10
|
+
|
5
11
|
Change log v.0.2.27
|
6
12
|
|
7
13
|
**Fix**: Fixed an issue where a `nil` outline count would cause PDF merger to fail.
|
data/README.md
CHANGED
@@ -18,19 +18,17 @@ Quick rundown:
|
|
18
18
|
|
19
19
|
* When reading PDF Forms, some form data might be lost. I tried fixing this to the best of my ability, but I'm not sure it all works just yet.
|
20
20
|
|
21
|
-
* When combining PDF Forms, form data might be unified.
|
21
|
+
* When combining PDF Forms, form data might be unified. I couldn't fix this because this is how PDF forms work (filling a feild fills in the data in any field with the same name), but frankly, I kinda liked the issue... it's almost a feature.
|
22
22
|
|
23
|
-
* When unifying the same TOC data more then once, one of the references will be unified with the other.
|
23
|
+
* When unifying the same TOC data more then once, one of the references will be unified with the other (meaning that if the pages look the same, both references will link to the same page instead of linking to two different pages). You can fix this by adding content to the pages before merging the PDF files (i.e. add empty text boxes to all the pages).
|
24
24
|
|
25
|
-
*
|
25
|
+
* Some links and data (URL links and PDF "Named Destinations") are stored at the root of a PDF and they aren't linked back to from the page. Keeping this information requires merging the PDF objects rather then their pages.
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
For this reason, some links will be lost when ripping pages out of PDF files and merging them with another PDF.
|
27
|
+
Some links will be lost when ripping pages out of PDF files and merging them with another PDF.
|
30
28
|
|
31
29
|
* Some encrypted PDF files (usually the ones you can't view without a password) will fail quietly instead of noisily.
|
32
30
|
|
33
|
-
* Sometimes the CombinePDF will raise an exception even if the PDF could be parsed (i.e., when PDF optional content exists)... I find it better to err on the side of caution, although for optional content PDFs
|
31
|
+
* Sometimes the CombinePDF will raise an exception even if the PDF could be parsed (i.e., when PDF optional content exists)... I find it better to err on the side of caution, although for optional content PDFs an exception is avoidable using `CombinePDF.load(pdf_file, allow_optional_content: true)`.
|
34
32
|
|
35
33
|
CombinePDF is written natively in Ruby and should (presumably) work on all Ruby platforms that follow Ruby 2.0 compatibility.
|
36
34
|
|
@@ -187,3 +185,12 @@ Credit to his wonderful is given here. Please respect his license and copyright.
|
|
187
185
|
License
|
188
186
|
=======
|
189
187
|
MIT
|
188
|
+
|
189
|
+
Contributions
|
190
|
+
=======
|
191
|
+
|
192
|
+
You can look at the [GitHub Issues Page](https://github.com/boazsegev/combine_pdf/issues) and see the ["help wanted"](https://github.com/boazsegev/combine_pdf/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) tags.
|
193
|
+
|
194
|
+
If you're thinking of donations or sending me money - no need. This project can sustain itself without your money.
|
195
|
+
|
196
|
+
What this project needs is the time given by caring developers who keep it up to date and fix any documentation errors or issues they notice ... having said that, gifts (such as free coffee or iTunes gift cards) are always fun. But I think there are those in real need that will benefit more from your generosity.
|
@@ -60,19 +60,40 @@ module CombinePDF
|
|
60
60
|
# following the reference chain and assigning a pointer to the correct Resouces object.
|
61
61
|
# (assignments of Strings, Arrays and Hashes are pointers in Ruby, unless the .dup method is called)
|
62
62
|
|
63
|
-
#
|
64
|
-
|
63
|
+
# setup references to avoid method calls.
|
64
|
+
local_res = resources
|
65
|
+
local_val = nil
|
66
|
+
# setup references to avoid method calls.
|
67
|
+
remote_res = obj.resources
|
68
|
+
remote_val = nil
|
69
|
+
|
70
|
+
# add each of the new resources in the uncoming Page to the local resource Hash
|
65
71
|
obj.resources.each do |key, new_val|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
72
|
+
# keep CombinePDF structural data intact.
|
73
|
+
next if PDF::PRIVATE_HASH_KEYS.include?(key)
|
74
|
+
# review
|
75
|
+
if local_res[key].nil?
|
76
|
+
# no local data, adopt data from incoming page
|
77
|
+
local_res[key] = new_val
|
78
|
+
# go back to looping, no need to parse the rest of the Ruby
|
79
|
+
next
|
80
|
+
elsif (local_val = actual_object(local_res[key])).is_a?(Hash) && (new_val = actual_object(new_val)).is_a?(Hash)
|
81
|
+
# marge data with priority to the incoming page's data
|
82
|
+
new_val.update local_val # make sure the old values are respected
|
83
|
+
local_val.update new_val # transfer old and new values to the injected page
|
84
|
+
end # Do nothing if array or anything else
|
75
85
|
end
|
86
|
+
|
87
|
+
# concat the Annots array? (what good are named links if the names are in the unaccessible Page Catalog?)
|
88
|
+
# if obj[:Annots]
|
89
|
+
# if (local_val = actual_object(self[:Annots])).nil?
|
90
|
+
# self[:Annots] = obj[:Annots]
|
91
|
+
# elsif local_val.is_a?(Array) && (remote_val = actual_object(obj[:Annots])).is_a?(Array)
|
92
|
+
# local_val.concat remote_val
|
93
|
+
# end
|
94
|
+
# end
|
95
|
+
|
96
|
+
# set ProcSet to recommended value
|
76
97
|
resources[:ProcSet] = [:PDF, :Text, :ImageB, :ImageC, :ImageI] # this was recommended by the ISO. 32000-1:2008
|
77
98
|
|
78
99
|
if top # if this is a stamp (overlay)
|
data/lib/combine_pdf/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.28
|
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-07-
|
11
|
+
date: 2016-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-rc4
|