We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to set margin in cm

Hi all,

How can I set Text.Margin in cm
for example:

Pdf pdf1 = new Pdf();

pdf1.PageSetup.PageHeight = PageSize.A4Height;
pdf1.PageSetup.PageWidth = PageSize.A4Width;

Section sec1 = pdf1.Sections.Add();

Text text1 = new Text(sec1, “Helabakes gij se schelm”);
text1.Margin.Top = “2cm”;


Tks BStroek


Thanks for considering Aspose.

Text.Margin.Top sets a float value for the top margin. The default unit for MarginInfo is Points. You can set the value in cm or inch using XML. For more information kindly visit MarginInfo Members.


I want to add more comment. "cm" and "inch" is supported in XML only. You have to use point in API. 1 cm = 28.3 points and 1 inch = 72 points.

OK tks

Gr Stroek