I’m using 11.1 version of Aspose.pdf. My requirement is to create a list paragraph having userlabel and text following it see attached Expected_Output.png file
I tried below code to achieve it but the text are getting wrapped at the center of the page (look at the List.pdf output). I want output similar to Expected_Output.png. Let me know can i achieve this.
Document pdfDoc = new Document();
pdfDoc.PageInfo.Width = 612.0;
pdfDoc.PageInfo.Height = 792.0;
pdfDoc.PageInfo.Margin = new Aspose.Pdf.MarginInfo();
pdfDoc.PageInfo.Margin.Left = 72;
pdfDoc.PageInfo.Margin.Right = 72;
pdfDoc.PageInfo.Margin.Top = 72;
pdfDoc.PageInfo.Margin.Bottom = 72;
Page pdfPage = pdfDoc.Pages.Add();
pdfPage.PageInfo.Width = 612.0;
pdfPage.PageInfo.Height = 792.0;
pdfPage.PageInfo.Margin = new Aspose.Pdf.MarginInfo();
pdfPage.PageInfo.Margin.Left = 72;
pdfPage.PageInfo.Margin.Right = 72;
pdfPage.PageInfo.Margin.Top = 72;
pdfPage.PageInfo.Margin.Bottom = 72;
Aspose.Pdf.FloatingBox floatBox = new Aspose.Pdf.FloatingBox();
floatBox.Margin = pdfPage.PageInfo.Margin;
pdfPage.Paragraphs.Add(floatBox);
Aspose.Pdf.Text.Font font = Aspose.Pdf.Text.FontRepository.FindFont(“Arial”);
Aspose.Pdf.Heading heading = new Aspose.Pdf.Heading(1);
heading.UserLabel = “1)”;
heading.IsAutoSequence = true;
heading.Margin = new MarginInfo(10, 0, 0, 0);
TextSegment segment = new TextSegment(“the value, as of the effective date of the plan, of property to be distributed under the plan onaccount of each allowed”);
segment.TextState.Font = font;
segment.TextState.FontSize = 10;
segment.TextState.Font.IsEmbedded = true;
heading.Segments.Add(segment);
floatBox.Paragraphs.Add(heading);
heading = new Aspose.Pdf.Heading(1);
heading.IsInLineParagraph = true;
heading.Hyperlink = new WebHyperlink(“https://google.com”);
segment = new TextSegment(" hyperlink text");
segment.TextState.Font = font;
segment.TextState.FontSize = 10;
segment.TextState.Font.IsEmbedded = true;
heading.Segments.Add(segment);
floatBox.Paragraphs.Add(heading);
heading = new Aspose.Pdf.Heading(1);
heading.IsInLineParagraph = true;
segment = new TextSegment(" Founded in 1902 as Madrid Football Club, the team has traditionally worn a white home kit since inception");
segment.TextState.Font = font;
segment.TextState.FontSize = 10;
segment.TextState.Font.IsEmbedded = true;
heading.Segments.Add(segment);
floatBox.Paragraphs.Add(heading);
Aspose.Pdf.Heading heading2 = new Aspose.Pdf.Heading(1);
heading2.UserLabel = “a)”;
heading2.IsInList = true;
heading2.IsAutoSequence = true;
heading2.Margin = new MarginInfo(25, 0, 0, 0);
segment = new TextSegment("the value, as of the effective date of the plan, of property to be distributed ");
segment.TextState.Font = font;
segment.TextState.FontSize = 10;
segment.TextState.Font.IsEmbedded = true;
heading2.Segments.Add(segment);
floatBox.Paragraphs.Add(heading2);
Aspose.Pdf.Heading heading3 = new Aspose.Pdf.Heading(1);
heading3.UserLabel = “i)”;
heading3.IsInList = true;
heading3.IsAutoSequence = true;
heading3.Margin = new MarginInfo(40, 0, 0, 0);
segment = new TextSegment("the value, as of the effective date of the plan, of property to be distributed ");
segment.TextState.Font = font;
segment.TextState.FontSize = 10;
//segment.TextState.LineSpacing = 13;
segment.TextState.Font.IsEmbedded = true;
heading3.Segments.Add(segment);
floatBox.Paragraphs.Add(heading3);
Aspose.Pdf.Heading heading4 = new Aspose.Pdf.Heading(1);
heading4.UserLabel = “2)”;
heading4.IsInList = true;
heading4.IsAutoSequence = true;
heading4.Margin = new MarginInfo(10, 0, 0, 0);
segment = new TextSegment("the value, as of the effective date of the plan, of property to be distributed ");
segment.TextState.Font = font;
segment.TextState.FontSize = 10;
segment.TextState.Font.IsEmbedded = true;
heading4.Segments.Add(segment);
floatBox.Paragraphs.Add(heading4);
string outFile = @“c:\temp\List.pdf”;
pdfDoc.Save(outFile);