diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a9b229..6f62e51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +#### Change log v.1.0.24 (2023-10-19) + +**Fix**: possible `nil` in loop. Credit to @jkowens for PR #231 and adding a quick fix using a simple guard. + +**Fix**: preserve file creation date metadata where relevant. + #### Change log v.1.0.23 (2023-04-04) **Feature**: merged PR #177 for the `raise_on_encrypted: true` option support. Credit to @leviwilson and @kimyu92 for the PR. diff --git a/combine_pdf.gemspec b/combine_pdf.gemspec index cc324f1..a707119 100644 --- a/combine_pdf.gemspec +++ b/combine_pdf.gemspec @@ -7,7 +7,7 @@ Gem::Specification.new do |spec| spec.name = "combine_pdf" spec.version = CombinePDF::VERSION spec.authors = ["Boaz Segev"] - spec.email = ["boaz@2be.co.il"] + spec.email = ["bo@bowild.com"] spec.summary = %q{Combine, stamp and watermark PDF files in pure Ruby.} 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).} spec.homepage = "https://github.com/boazsegev/combine_pdf" diff --git a/lib/combine_pdf/pdf_public.rb b/lib/combine_pdf/pdf_public.rb index d2e732e..32e0b34 100644 --- a/lib/combine_pdf/pdf_public.rb +++ b/lib/combine_pdf/pdf_public.rb @@ -175,8 +175,12 @@ def save(file_name, options = {}) def to_pdf(options = {}) # reset version if not specified @version = 1.5 if @version.to_f == 0.0 + # set info for merged file - @info[:ModDate] = @info[:CreationDate] = Time.now.strftime "D:%Y%m%d%H%M%S%:::z'00" + unless(@info[:CreationDate].is_a?(String)) + @info[:CreationDate] = Time.now unless @info[:CreationDate].is_a?(Time) + @info[:CreationDate] = @info[:CreationDate].getgm.strftime("D:%Y%m%d%H%M%S%:::z'00") + end @info[:Subject] = options[:subject] if options[:subject] @info[:Producer] = options[:producer] if options[:producer] # rebuild_catalog diff --git a/lib/combine_pdf/version.rb b/lib/combine_pdf/version.rb index 50ad470..ee5570c 100644 --- a/lib/combine_pdf/version.rb +++ b/lib/combine_pdf/version.rb @@ -1,3 +1,3 @@ module CombinePDF - VERSION = '1.0.23'.freeze + VERSION = '1.0.24'.freeze end diff --git a/test/automated b/test/automated index 584b94d..2bb009a 100755 --- a/test/automated +++ b/test/automated @@ -3,7 +3,8 @@ $VERBOSE = true require 'benchmark' -$LOAD_PATH.unshift File.expand_path(File.join('..', '..', 'lib'), __FILE__) +Dir.chdir File.expand_path(File.join('..', '..', 'lib'), __FILE__) +$LOAD_PATH.unshift Dir.pwd require 'combine_pdf' # require 'bundler/setup'