Add Paragraph not expected behaviour in whole object

Hello,

I have a problem using de TextParagraph/Textbuilder objects. If i’m adding two paragraphs i have a weird behaviour. If i add two paragraphs sometimes i get two sections with on paragraph on each, sometimes i get 1 section, 1 paragraph, 1 line with the 2 words in the resulting PDF.

Why when i add a paragraph it does not simply add a paragraph ? There is some kind of intelligence that i don’t understand.

Here the code :

public void BugAspose()
{
	var docPdf = new Document();
	var pdfPage = docPdf.Pages.Add();

	var paragraph1 = new TextParagraph();
	var line1 = new TextFragment();
	
	var textFragment = new TextFragment("Lorem");
	textFragment.TextState.Invisible = true;
	textFragment.Rectangle.LLX = 0;
	textFragment.Rectangle.LLY = 0;
	textFragment.Rectangle.URX = 34;
	textFragment.Rectangle.URY = 12;

	foreach (var segment in textFragment.Segments)
	{
		line1.Segments.Add(segment);
	}
	
	paragraph1.AppendLine(line1);
	new TextBuilder(pdfPage).AppendParagraph(paragraph1);

	var paragraph2 = new TextParagraph();
	var line2 = new TextFragment();

	var textFragment2 = new TextFragment("Ipsum");
	textFragment2.TextState.Invisible = true;
	textFragment2.Rectangle.LLX = 0;
	textFragment2.Rectangle.LLY = 50;
	textFragment2.Rectangle.URX = 34;
	textFragment2.Rectangle.URY = 62;

	foreach (var segment in textFragment2.Segments)
	{
	   line2.Segments.Add(segment);
	}
	
	paragraph2.AppendLine(line2);

	new TextBuilder(pdfPage).AppendParagraph(paragraph2);

	ParagraphAbsorber pdfMarkup = new ParagraphAbsorber();
	pdfMarkup.Visit(pdfPage);

	var paragraphs = pdfMarkup.PageMarkups.First().Sections.SelectMany(s => s.Paragraphs).ToArray();
	Assert.Equal(2, paragraphs.Count());
}

@Philigane

Could you please also share the code snippet in which you were able to notice two paragraphs after adding them? We will further proceed to assist you accordingly.

I already wrote the code (it’s a test case you can easily test it with xunit or nunit). For getting this case you just have to move the second word position further.

@Philigane

We were able to notice that API returned only 1 Paragraph Count when we added 3 paragraphs in it. We have logged an investigation ticket as PDFNET-49627 in our issue tracking system for this case. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.