'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsSystem.DrawingImportsGrapeCity.Documents.Pdf '' This sample demonstrates the most basic paragraph formatting options:'' - first line indent'' - line spacing.PublicClassParagraphFormattingFunctionCreatePDF(ByVal stream AsStream) AsInteger Dim makePara As Func(OfString) =Function()ReturnUtil.LoremIpsum(1, 5, 10, 15, 30)EndFunction Dim doc = NewGcPdfDocument()Dim g = doc.NewPage().Graphics'' Using Graphics.CreateTextLayout() ensures that TextLayout's resolution'' is set to the same value as that of the graphics (which is 72 dpi by default):Dim tl = g.CreateTextLayout()'' Default font: tl.DefaultFormat.Font = StandardFonts.Times tl.DefaultFormat.FontSize = 12'' Set TextLayout to the whole page: tl.MaxWidth = doc.PageSize.Width tl.MaxHeight = doc.PageSize.Height'' ...and have it manage the page margins (1" all around): tl.MarginAll = tl.Resolution'' First line offset 1/2": tl.FirstLineIndent = 72 / 2'' 1.5 line spacing: tl.LineSpacingScaleFactor = 1.5F'' tl.Append(makePara()) tl.PerformLayout(True)'' Render text at (0,0) (margins are added by TextLayout): g.DrawTextLayout(tl, PointF.Empty)'''' Done: doc.Save(stream)Return doc.Pages.CountEndFunctionEndClass