Sha256: 26c9922d232e111a503896cce351bf6b516e858f4c50390a4420ec09ee9bd56c

Contents?: true

Size: 798 Bytes

Versions: 2

Compression:

Stored size: 798 Bytes

Contents

module Asposepdfjava
  module RemoveMetadata
    def initialize()
    	# The path to the documents directory.
        data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
        
        # Open a pdf document.
        doc = Rjb::import('com.aspose.pdf.Document').new(data_dir + "input1.pdf")

        if doc.getMetadata().contains("pdfaid:part")
            doc.getMetadata().removeItem("pdfaid:part")
        end    
        
        if doc.getMetadata().contains("dc:format")
            doc.getMetadata().removeItem("dc:format")
        end

        # save update document with new information
        doc.save(data_dir + "Remove_Metadata.pdf")

        puts "Removed metadata successfully, please check output file."
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
asposepdfjava-0.0.2 lib/asposepdfjava/Document/removemetadata.rb
asposepdfjava-0.0.1 lib/asposepdfjava/Document/removemetadata.rb