I use aspose.net PDF V18.12.0, i want to write a long text in a particular position on the page :
- in the simple version, i only use a textfragment but the textfragment.position is ignore ?
- when i use a textparagraph, the position is correct but with left alignment, only a part of my text is print, in justify alignment , only the fisrt word are write
Is there anything wrong with my code ?
_pdfDocument = new Document()
{ PageInfo = new PageInfo { Margin = new MarginInfo(28, 28, 28, 42) }};
_pdfPage = _pdfDocument.Pages.Add();
TextFragment textFragment = new TextFragment("Ibi victu recreati et quiete, postquam abierat timor, vicos opulentos adorti" +
" equestrium adventu cohortium, quae casu propinquabant, nec resistere " +
"planitie porrecta conati digressi sunt retroque concedentes omne iuventutis " +
"robur relictum in sedibus acciverunt.Ibi victu recreati et quiete, postquam abierat timor, vicos " +
"opulentos adorti equestrium adventu cohortium, quae casu propinquabant, nec resistere planitie porrecta " +
"conati digressi sunt retroque concedentes omne iuventutis robur relictum in sedibus acciverunt.");
textFragment.Position = new Position(200, 500);
// Set text properties
textFragment.TextState.FontSize = 12;
textFragment.TextState.Font = FontRepository.FindFont("Calibri");
textFragment.HorizontalAlignment = HorizontalAlignment.Justify;
// Position ignore ?
_pdfPage.Paragraphs.Add(textFragment);
TextParagraph parbloc = new TextParagraph();
parbloc.Rectangle = new Rectangle(50, 100, 500, 400);
// With Left => Text is partially print
// with Justify => only the first words are printed
parbloc.HorizontalAlignment = HorizontalAlignment.Left;
parbloc.FormattingOptions = new TextFormattingOptions(TextFormattingOptions.WordWrapMode.ByWords);
parbloc.VerticalAlignment = VerticalAlignment.Top;
parbloc.AppendLine(textFragment);
TextBuilder textBuilder = new TextBuilder(_pdfPage);
textBuilder.AppendParagraph(parbloc);
// Step 5
_pdfDocument.Save("D:\\PDF.pdf");