Width of a FormattedTextArea overflow

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for Java (v4)  /  Re: Width of a FormattedTextArea overflow

DynamicPDF Generator for Java (v4) Forum

Hi,
 I want to put an image on the left corner of a page and FormattedTextArea around this image : at the right and at the bottom.

The second FormattedTextArea is the overFlow of the first.
The width of the second is the same as the first one.

How can I set the with of the second to match the width of the page ?
A call to the setWidth method throws an exception :
 com.cete.dynamicpdf.GeneratorException: Width can not be changed on an overflow FormattedTextArea.
Posted by a ceTe Software moderator
Hello,

It is not possible to change the width of the overflow FormattedTextArea using our DynamicPDF Generator product. You can only set X, Y positions and height for the overflow FormattedTextArea.  You can use our another page element called TextArea where in you can change the width of the overflow TextArea. Also please find the below sample code to add image and text around the image dynamically using TextArea and Image page elements.

            Page page = new Page();
            Image image = new Image(@"C:\temp\ Winter.jpg", 0, 0);
            image.Width = 400;
            image.Height = 100;
            page.Elements.Add(image);
            float wd = page.Dimensions.Width - (page.Dimensions.RightMargin + page.Dimensions.LeftMargin + image.Width);
            TextArea textArea = new TextArea(myText,(image.X+ image.Width), image.Y, wd, image.Height);
            textArea.Align = TextAlign.Justify;
            do
            {
                page.Elements.Add(textArea);
                document.Pages.Add(page);
                float y = textArea.Y + textArea.Height;
                float width=page.Dimensions.Width-(page.Dimensions.LeftMargin+page.Dimensions.RightMargin);
                textArea = textArea.GetOverflowTextArea(0, y, width, 200);
            } while (textArea != null);
            document.Draw(@"C:\MyDocument.pdf");

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 10:49 AM.