Skip to content

Commit

Permalink
docs + preserve :CreationDate where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
boazsegev committed Oct 19, 2023
1 parent 23b4478 commit fc763b6
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion combine_pdf.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.name = "combine_pdf"
spec.version = CombinePDF::VERSION
spec.authors = ["Boaz Segev"]
spec.email = ["[email protected]"]
spec.email = ["[email protected]"]
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"
Expand Down
6 changes: 5 additions & 1 deletion lib/combine_pdf/pdf_public.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/combine_pdf/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module CombinePDF
VERSION = '1.0.23'.freeze
VERSION = '1.0.24'.freeze
end
3 changes: 2 additions & 1 deletion test/automated
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit fc763b6

Please sign in to comment.