Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Dec 31, 2015 10:34 am

Code: Select all
PdfDocument doc = new PdfDocument();
doc.PageScaling = PdfPrintPageScaling.ActualSize;
doc.LoadFromFile("myDocument.pdf");

foreach (PdfPageBase page in doc.Pages)
{
      //Result returns the pixel type. But I want to show in millimeters
     Console.WriteLine("PageSize: {0}X{1}", page.Size.Width, page.Size.Height);
}

evrenatila
 
Posts: 1
Joined: Thu Dec 31, 2015 10:23 am

Fri Jan 01, 2016 2:35 am

Hi,

Thanks for your posting and using our Spire.pdf.
Please try the following code snippet.
Code: Select all
 
  PdfUnitConvertor unitCvtr = new PdfUnitConvertor();
  float vaule = unitCvtr.ConvertUnits(page.Size.Width, PdfGraphicsUnit.Pixel, PdfGraphicsUnit.Millimeter);


Happy new year.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2774
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF