Example code is for an older version of Toolkit, newer code is available.
# Copyright (c) 2021 ActivePDF, Inc.
# ActivePDF Toolkit 2017
# Example generated 01/22/21
require 'win32ole'
# Get current path
strPath = File.expand_path(File.dirname(__FILE__)) + "\\"
# Instantiate Object
oTK = WIN32OLE.new("APToolkit.Object")
# Open the PDF to read from
intOpenInputFile = oTK.OpenInputFile(strPath + 'XMPproperties.pdf')
if intOpenInputFile != 0
puts "Error in OpenInputFile: #{intOpenInputFile}"
end
# Get the reference to the XMP object
oXMP = oTK.GetXMPManager()
# Get a document property
strPropertyValue = oXMP.GetDocumentProperty(2)
puts strPropertyValue
# Get a custom property
strPropertyValue = oXMP.GetCustomProperty('example')
puts strPropertyValue
# Set the namespace for the user property
oXMP.SetNamespace('dc', 'http://purl.org/dc/elements/1.1/')
# Get a user property
strPropertyValue = oXMP.GetUserProperty('contributor')
puts strPropertyValue
# Release Object
oXMP = ''
# Close the input file
oTK.CloseInputFile()
# Release Object
oTK = ''
# Process Complete
puts "Done!"