XpsDocument
CoreDocumentProperties
property
using System.IO;
using System.IO.Packaging;
using System.Windows.Xps.Packaging;
namespace StackOverflow
{
class Program
{
static void Main(string[] args)
{
const string XpsFilePath = @" ... path to XPS file ... ";
using (var document = new XpsDocument(XpsFilePath, FileAccess.ReadWrite))
{
PackageProperties properties = document.CoreDocumentProperties;
properties.Title = "Some title";
properties.Subject = "Some subject line";
properties.Keywords = "stackoverflow xps";
properties.Category = "Some category";
properties.Description = "Some kind of document";
properties.Creator = "me";
properties.LastModifiedBy = "me again";
properties.Revision = "Rev A";
properties.Version = "v1";
}
// XpsDocument is from System.Windows.Xps.Packaging, in ReachFramework assembly
// PackageProperties is from System.IO.Packaging, in WindowsBase assembly
}
}
}
using (var document = new XpsDocument(XpsFilePath, FileAccess.Read))
{
PackageProperties properties = document.CoreDocumentProperties;
System.Console.WriteLine(properties.Title);
// etc...
}