Insert HTML Text to PDF - Line Break

Hi, i have a HTML Text to insert into a pdf page. This is the Code:

 var ts = new TextState
        {
            Font = FontRepository.FindFont(_appConfiguration.PdfDefaultFont),
            FontSize = _appConfiguration.PdfDefaultFontSize,
            FontStyle = FontStyles.Regular,
            HorizontalAlignment = HorizontalAlignment.Left
        };
        ts.Font.IsEmbedded = true;
        HtmlFragment agendaTextHtml =
            new HtmlFragment(string.IsNullOrEmpty(letterText) ? " " : letterText)
            {
                TextState = ts
            };pdfDocument.Pages[pageCount].Paragraphs.Add(agendaTextHtml);

This is the HTML:

<p><span style="font-family: Arial;">pppppppppppppppppppppp&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span></p><p><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><span style="font-family: Arial;">pppppppppppppppppppppp</span><span style="font-family: Arial;">&nbsp;</span><br></p>

The HTML Text has no line break. The PDF is A4. See the Screenshot in file.
HTMLWithoutBreak.png (1.4 KB)

Regards Horst

@hstumpf

Can you please share complete runnable code so that we can investigate it accordingly.

Hi,
i send you the cs file
Regards
Horst
CreatePdf.zip (1.5 KB)

@hstumpf

I have created attached file with your code and request you to explain the expected output so that we can investigate it accordingly. test.pdf (60.2 KB)

Hi,

you must set in
var letterText = “”;
The Html Text where i send you in the first message.
I open it from file :
var letterText = File.ReadAllText(pathToHtml);

Regards
Horst

@hstumpf

I have created attached file with Adobe Acrobat which also breaks the line after first three occurrences of the text so this looks like expected behavior of the API. html - acrobat.pdf (10.2 KB)

Hi, i send you the cs file and the html file. With this Code the line break is missing in the pdf file!
Regards
Horst
CreatePdf.zip (1.8 KB)

@hstumpf

I request you to explain the issue with a screenshot. I have attached the PDF file created with your code. test.pdf (60.9 KB)

Hi,
i mark the issue in the image:
HtmlInPdfNoBreak.png (7.0 KB)

i have added a document where the expected representation is shown
SollHtmlInPdf.pdf (31.0 KB)

Regard
Horst

@hstumpf

A ticket with ID PDFNET-50428 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.