3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/asposepdfjava/Document/removemetadata.rb', line 3
def initialize()
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
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
doc.save(data_dir + "Remove_Metadata.pdf")
puts "Removed metadata successfully, please check output file."
end
|