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”;
sec1.Paragraphs.Add(text1);

pdf1.Save(“Test.PDF”);

Tks BStroek

Hi,

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.

Hi,

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