'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsSystem.DrawingImportsGrapeCity.Documents.PdfImportsGrapeCity.Documents.Pdf.StructureImportsGrapeCity.Documents.Pdf.MarkedContent '' This sample shows how to create tagged (structured) PDF.'' To see/explore the tags, open the document in Adobe Acrobat Pro and go to'' View | Navigation Panels | Tags.PublicClassTagParagraphsFunctionCreatePDF(ByVal stream AsStream) AsIntegerDim doc = NewGcPdfDocument()Dim rnd = Util.NewRandom()Dim pageCount = rnd.Next(3, 7) '' Create Part element, it will contain P (paragraph) elementsDim sePart = NewStructElement("Part") doc.StructTreeRoot.Children.Add(sePart) '' Add some pages, on each page add some paragraphs and tag them:For pageIndex = 0To pageCount - 1'' Add page:Dim page = doc.Pages.Add()Dim g = page.GraphicsConstmargin = 36.0FConstdy = 18.0F'' Add some paragraphs:Dim paraCount = rnd.Next(1, 5)Dim y = marginFor i = 0To paraCount - 1'' Create paragraph element:Dim seParagraph = NewStructElement("P") With {.DefaultPage = page}'' Add it to Part element: sePart.Children.Add(seParagraph)'' Create paragraph:Dim tl = g.CreateTextLayout() tl.DefaultFormat.Font = StandardFonts.Helvetica tl.DefaultFormat.FontSize = 12 tl.Append(Util.LoremIpsum(1, 1, 5, 5, 10)) tl.MaxWidth = page.Size.Width tl.MarginLeft = margin tl.MarginRight = margin tl.PerformLayout(True)'' Draw TextLayout within tagged content: g.BeginMarkedContent(NewTagMcid("P", i)) g.DrawTextLayout(tl, NewPointF(0, y)) g.EndMarkedContent() y += tl.ContentHeight + dy'' Add content item to paragraph StructElement: seParagraph.ContentItems.Add(NewMcidContentItemLink(i))NextNext'' Mark document as tagged: doc.MarkInfo.Marked = True'''' Done: doc.Save(stream)Return doc.Pages.CountEndFunctionEndClass