Get XMP Metadata from PDF File in Ruby

Aspose.PDF - Get XMP Metadata

To get XMP Metadata from Pdf document using Aspose.PDF Java for Ruby, simply invoke GetXMPMetadata module.

Ruby Code

# 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")

# Get properties

puts "xmp:CreateDate: " + doc.getMetadata().get_Item("xmp:CreateDate").to_s

puts "xmp:Nickname: " + doc.getMetadata().get_Item("xmp:Nickname").to_s

puts "xmp:CustomProperty: " + doc.getMetadata().get_Item("xmp:CustomProperty").to_s

Download Running Code

Download Get XMP Metadata (Aspose.PDF) from any of the below mentioned social coding sites: