combine_pdf 1.0.23 → 1.0.24

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: 94a057a85d5c2709211baa3ed7d7deaf73fe93d6bb39ef76e0441a166fb36926
4
- data.tar.gz: c7dc7060c7abd51d84ee871b5f818d6e23a797eb424a8a7a963b0ae7f7324921
3
+ metadata.gz: e4c508088d852d177d9e360d9c9b2327d4964e3126ceb61c8e652788bf0e2ffb
4
+ data.tar.gz: 0451512bbe0f7b61bbb2154fda45542e088bc1cee4bb905654ffde17cc196243
5
5
  SHA512:
6
- metadata.gz: 110074ae751586009d436dd4dc997c7d6bb71480d782270fe67834458cecc7479b58effc8102745a437c718426c97ca78d9ea3d2941355ba1ce8fc6f34ab2b8a
7
- data.tar.gz: 4cf409946ba651fd474f7ff8a3dbf56442afd96b35fe73b68013a9a863e01e9d766a516ea4ddd4f5af7f2c47192abc0619321a6bc01c5a4e0dcd0e192701d168
6
+ metadata.gz: f1eb1830a1cca67729c8b4161df3aabcd23b5cd993d9392051aeb6f93b5ac129dbd4e37c37ff3513cc426fa4bbca6682c9954f18f51f090f9b47da775ce0847f
7
+ data.tar.gz: ef9a12eb9eb0314973a3e76b6d69cb01bf2c0ee9d05e876824e88b657a771b00839a147d7d98e77f18a1d5f81196c92528958d2ac6b18f3b6cc9423d47d35c53
@@ -0,0 +1,28 @@
1
+ name: Main
2
+ on:
3
+ push:
4
+
5
+ jobs:
6
+ tests:
7
+ name: Tests
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ ruby: ["2.7", "3.0", "3.1", "3.2"]
13
+
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v3
17
+
18
+ - name: Setup Ruby
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ bundler-cache: true
23
+
24
+ - name: Generate lockfile
25
+ run: bundle lock
26
+
27
+ - name: Run tests
28
+ run: bundle exec rake test
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  # Change Log
2
2
 
3
- #### Change log v.1.0.23 (2023-03-04)
3
+ #### Change log v.1.0.24 (2023-10-19)
4
+
5
+ **Fix**: possible `nil` in loop. Credit to @jkowens for PR #231 and adding a quick fix using a simple guard.
6
+
7
+ **Fix**: preserve file creation date metadata where relevant.
8
+
9
+ #### Change log v.1.0.23 (2023-04-04)
4
10
 
5
11
  **Feature**: merged PR #177 for the `raise_on_encrypted: true` option support. Credit to @leviwilson and @kimyu92 for the PR.
6
12
 
data/combine_pdf.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "combine_pdf"
8
8
  spec.version = CombinePDF::VERSION
9
9
  spec.authors = ["Boaz Segev"]
10
- spec.email = ["boaz@2be.co.il"]
10
+ spec.email = ["bo@bowild.com"]
11
11
  spec.summary = %q{Combine, stamp and watermark PDF files in pure Ruby.}
12
12
  spec.description = %q{A nifty gem, in pure Ruby, to parse PDF files and combine (merge) them with other PDF files, number the pages, watermark them or stamp them, create tables, add basic text objects etc` (all using the PDF file format).}
13
13
  spec.homepage = "https://github.com/boazsegev/combine_pdf"
@@ -323,8 +323,8 @@ module CombinePDF
323
323
  str << 12
324
324
  when 48..57 # octal notation for byte?
325
325
  rep -= 48
326
- rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0].between?(48, 57)
327
- rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0].between?(48, 57) && (((rep << 3) + (str_bytes[0] - 48)) <= 255)
326
+ rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0]&.between?(48, 57)
327
+ rep = (rep << 3) + (str_bytes.shift-48) if str_bytes[0]&.between?(48, 57) && (((rep << 3) + (str_bytes[0] - 48)) <= 255)
328
328
  str << rep
329
329
  when 10 # new line, ignore
330
330
  str_bytes.shift if str_bytes[0] == 13
@@ -175,8 +175,12 @@ module CombinePDF
175
175
  def to_pdf(options = {})
176
176
  # reset version if not specified
177
177
  @version = 1.5 if @version.to_f == 0.0
178
+
178
179
  # set info for merged file
179
- @info[:ModDate] = @info[:CreationDate] = Time.now.strftime "D:%Y%m%d%H%M%S%:::z'00"
180
+ unless(@info[:CreationDate].is_a?(String))
181
+ @info[:CreationDate] = Time.now unless @info[:CreationDate].is_a?(Time)
182
+ @info[:CreationDate] = @info[:CreationDate].getgm.strftime("D:%Y%m%d%H%M%S%:::z'00")
183
+ end
180
184
  @info[:Subject] = options[:subject] if options[:subject]
181
185
  @info[:Producer] = options[:producer] if options[:producer]
182
186
  # rebuild_catalog
@@ -1,3 +1,3 @@
1
1
  module CombinePDF
2
- VERSION = '1.0.23'.freeze
2
+ VERSION = '1.0.24'.freeze
3
3
  end
data/test/automated CHANGED
@@ -3,7 +3,8 @@
3
3
  $VERBOSE = true
4
4
 
5
5
  require 'benchmark'
6
- $LOAD_PATH.unshift File.expand_path(File.join('..', '..', 'lib'), __FILE__)
6
+ Dir.chdir File.expand_path(File.join('..', '..', 'lib'), __FILE__)
7
+ $LOAD_PATH.unshift Dir.pwd
7
8
  require 'combine_pdf'
8
9
  # require 'bundler/setup'
9
10
 
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.23
4
+ version: 1.0.24
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-04-04 00:00:00.000000000 Z
11
+ date: 2023-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-rc4
@@ -84,11 +84,12 @@ description: A nifty gem, in pure Ruby, to parse PDF files and combine (merge) t
84
84
  with other PDF files, number the pages, watermark them or stamp them, create tables,
85
85
  add basic text objects etc` (all using the PDF file format).
86
86
  email:
87
- - boaz@2be.co.il
87
+ - bo@bowild.com
88
88
  executables: []
89
89
  extensions: []
90
90
  extra_rdoc_files: []
91
91
  files:
92
+ - ".github/workflows/main.yml"
92
93
  - ".gitignore"
93
94
  - ".travis.yml"
94
95
  - CHANGELOG.md