こんな
var XpsDocument xd = new System.Windows.Xps.Packaging.XpsDocument("test.xps", System.IO.FileAccess.Read);
var seq = xd.GetFixedDocumentSequence();
seq.DocumentPaginator.ComputePageCount();
int count = seq.DocumentPaginator.PageCount;
for (int p = 0; p < count; p++)
{
var page = seq.DocumentPaginator.GetPage(p);
Size size = page.Size;
double ih = size.Height / 96;
double iw = size.Width / 96;
double ch = size.Height / 96 * 2.54;
double cw = size.Width / 96 * 2.54;
System.Diagnostics.Debug.WriteLine(string.Format("Page={0}\t{1:f2}inx{2:f2}in\t{3:f1}cmx{4:f1}cm", p, iw, ih, cw, ch));
}
#必ずしも全ページが同じ大きさとは限らない
個別に明示されていない限りgekkaがフォーラムに投稿したコードにはフォーラム使用条件に基づき「MICROSOFT LIMITED PUBLIC LICENSE」が適用されます。(かなり自由に使ってOK!)