Skip to content

Commit

Permalink
adds support for drop_xfa and drop_xmp options. fixes jkraemer#68
Browse files Browse the repository at this point in the history
  • Loading branch information
jkraemer committed Sep 6, 2018
1 parent 8e9781e commit c4c37cc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/pdf_forms/pdftk_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class PdftkWrapper
#
# The pdftk binary may also be explecitly specified:
# PdftkWrapper.new('/usr/bin/pdftk', :flatten => true, :encrypt => true, :encrypt_options => 'allow Printing')
#
# Besides the options shown above, the drop_xfa or drop_xmp options are
# also supported.
def initialize(*args)
pdftk, options = normalize_args *args
@pdftk = Cliver.detect! pdftk
Expand Down Expand Up @@ -136,8 +139,10 @@ def option_or_global(attrib, local = {})
def append_options(args, local_options = {})
return args if options.empty? && local_options.empty?
args = args.dup
if option_or_global(:flatten, local_options)
args << 'flatten'
%i(flatten drop_xfa drop_xmp).each do |option|
if option_or_global(option, local_options)
args << option.to_s
end
end
if option_or_global(:encrypt, local_options)
encrypt_pass = option_or_global(:encrypt_password, local_options)
Expand Down

0 comments on commit c4c37cc

Please sign in to comment.