Word Breaks in TextStamps

Hello! I’m trying to make some dynamic headers by using TextStamps.

The current issue is that my dynamic variable sometimes has long words that don’t have a whitespace to separate them, so the word renders past my MaxRowWidth setting. I was hoping for there to be a word-break property to set, much like word-wrap. Since the text doesn’t break, it sometimes spills over to my other stamps. Do TextStamp or TextState support a method for word-breaking?

var some_really_long_text = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
var top_right_text = "some header goes here";
page.AddStamp(new TextStamp(some_really_long_text)
        {
            TopMargin = 50,
            VerticalAlignment = VerticalAlignment.Top,
            HorizontalAlignment = HorizontalAlignment.Center,
            WordWrap = true,
            Scale = false,
            MaxRowWidth = 200,
            TextAlignment = HorizontalAlignment.Center,
            TextState =
            {
                HorizontalAlignment = HorizontalAlignment.Justify,
                Font = FontRepository.FindFont("Arial"),
                ForegroundColor = Color.Black,
                FontStyle = FontStyles.Bold,
                FontSize = 10.0f
            }
        });
        //adds top-right page text stamp
        page.AddStamp(new TextStamp(top_right_text)
        {
            TopMargin = 50,
            RightMargin = half_an_inch,
            VerticalAlignment = VerticalAlignment.Top,
            HorizontalAlignment = HorizontalAlignment.Right,
            WordWrap = true,
            Scale = false,
            Width = 550 / 3,
            TextState =
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                Font = FontRepository.FindFont("Arial"),
                ForegroundColor = Color.Black,
                FontStyle = FontStyles.Bold,
                FontSize = 10.0f
            }
        });

@joshih0830,

Can you please try to use WordWrap = true on your end. This will help you to achieve your requirements. If there is still an issue than please share feedback with us.

I do have WordWrap = true. My issue isn’t that it’s not word-wrapping, it’s that the words aren’t breaking when max width is reached.

Hopefully this clears things up.
here’s a picture with

var some_really_long_text = “some_really_long_word_that_doesnt_break_once_max_width_is_reached. this part should show on lines below because wrap is working”;

image.png (11.8 KB)

there are 3 stamps in the picture.
left is “SOME_EXPORT_NAME1234”,
center is the variable some_really_long_text,
right is $“Date: {DateTime.Now()}”

@joshih0830,

I have observed your issue and like to inform that I have created investigation ticket with ID PDFNET-48066 in our issue tracking system to investigate and resolve this issue as soon possible.

Hi
Is there any news?
Also need to break words when width limit is reached

@kmikhailiuk

We are afraid that the earlier logged issue has not been yet resolved. However, we have recorded your concerns and will surely consider them during ticket investigation. We will inform you as soon as we have some definite updates in this regard. Please be patient and spare us some time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFNET-48066) have been fixed in Aspose.PDF for .NET 24.3.