class Pdfmdclean

Class: pdfmdclean

Clean metadata from a document

Attributes

filename[RW]
tags[RW]

Public Class Methods

new(filename) click to toggle source
Calls superclass method Pdfmd::new
# File lib/pdfmd/pdfmdclean.rb, line 9
def initialize(filename)
  super(filename)
end

Public Instance Methods

run() click to toggle source

Run the actual cleaning

# File lib/pdfmd/pdfmdclean.rb, line 14
def run()

  # Figure out which tags actually to reset.
  if @tags.nil? or @tags == 'all'
    @tags = @@default_tags
  elsif @tags.is_a?(String)
    @tags = @tags.split(',')
  end

  # Create the command to delete all the metatags
  command   = 'exiftool'
  parameter = ' -overwrite_original'
  @tags.each do |current_tag|
    parameter << " -#{current_tag}="
  end
  parameter << ' ' 

  `#{command} #{parameter} #{@filename}`
  self.log('info', "Cleaning tags '#{@tags.join(', ').to_s}' from file '#{@filename}'.")
end