Wrap around image

Wrap around image

Forum member · Aug 12, 2013
Is there any API to assist with wrapping a TextArea or FormattedTextArea around an image? I have a text area which is taller than an image that is left aligned on the page. How can I flow the text around that image? e.g. [~~~] Hello world. Here is [___] some text that floats around a left-aligned image that is much taller than the image. Thanks

Re: Wrap around image

Support · Aug 12, 2013
Hello, Yes, you can add text around the image without any problem using our DynamicPDF Generator for .NET product. You can use the Image page element to add the image at desired position and TextArea page element to add the text around the image. You can place the TextArea at desired position using the X and Y position coordinates and also you can set the height as of Image using Height property. You will need to check for the over flow text and then get the OverflowTextArea and add it to the page by setting the calculated dimensions and positions. Below is the sample code for it. Document document = new Document(); Page page = new Page(); string text = "This is example code to add text arround the image within the PDF page"; text += text; text += text; text += text; Image image = new Image(@"Winter.jpg", 0, 0, 1); image.Width = 200; image.Height = 200; page.Elements.Add(image); TextArea textArea = new TextArea(text, (image.X + image.Width + 5), image.Y, 100, image.Height); page.Elements.Add(textArea); float textAreaWidth = textArea.Width; if (textArea.HasOverflowText()) { textArea = textArea.GetOverflowTextArea(); textArea.X = image.X; textArea.Y = image.Y + image.Height ; textArea.Width = image.Width + textAreaWidth; textArea.Height = textArea.GetRequiredHeight(); page.Elements.Add(textArea); } document.Pages.Add(page); document.Draw(@"C:\\Mydocument.pdf"); Feel free to download fully functional evaluation edition of DynamicPDF Generator for .NET product from our website here . Thanks, ceTe Software Support Team.

Re: Wrap around image

Forum member · Aug 12, 2013
I see the principle now. Many thanks.

Re: Wrap around image

Forum member · Nov 13, 2013
Hello, I'm trying to do the same as in the code above. But I've a FormattedTextArea which has to be around an image. I'm getting an error that the Width cannot be set with a GetOverflowFormattedTextArea() method. What am I doing wrong? my code is: FormattedTextArea fixedTextArea = new FormattedTextArea(itemtext, 10, 10, 100, 100); page.Elements.Add(fixedTextArea ); FormattedTextArea overflowtextArea = fixedTextArea.GetOverflowFormattedTextArea(); overflowtextArea.Height = overflowtextArea.GetRequiredHeight(); overflowtextArea.Width = 500; // this throws an error !! page.Elements.Add(overflowtextArea); Thanks, Onno

Re: Wrap around image

Forum member · Nov 13, 2013
Try setting the width first? Because then it will know what height it needs.

Re: Wrap around image

Forum member · Nov 13, 2013
Hi, I'm sorry, posted old code. Already changed the two lines, but same error. my code is: FormattedTextArea fixedTextArea = new FormattedTextArea(itemtext, 10, 10, 100, 100); page.Elements.Add(fixedTextArea ); FormattedTextArea overflowtextArea = fixedTextArea.GetOverflowFormattedTextArea(); overflowtextArea.Width = 500; // this throws an error !! overflowtextArea.Height = overflowtextArea.GetRequiredHeight(); page.Elements.Add(overflowtextArea);

Re: Wrap around image

Support · Nov 13, 2013
Hello, Yes, width of the FormattedTextArea is fixed and you can set this once at the time of creating the FormattedTextArea class object. It is not possible to set the width for the over flow FormattedTextArea using our DynamicPDF Generator for .NET product. This is desired behavior with our DynamicPDF Generator for .NET product API. Thanks, ceTe Software Support Team.

Re: Wrap around image

Forum member · Nov 13, 2013
Hello, thanks for the info. is there another way to wrap formated text around an image?

Re: Wrap around image

Support · Nov 13, 2013
Hello, You can achieve your requirements by adding the text around the image using separate FormattedTextArea objects. It is not possible to use a single FormattedTextArea page element and add the text around the image as width of the FormattedTextArea is fixed. Thanks, ceTe Software Support Team.

Re: Wrap around image

Forum member · Nov 13, 2013
Hi, I already tried to use multiple FormattedTextArea , but the problem is, I have only one text and I cannot determine how much of this text can be put in one FormattedTextArea and how much text is left for the next FormattedTextArea . I tried this: - put text in FormattedTextArea fixedTextArea - get overflowtext with FormattedTextArea overflowtextArea = fixedTextArea.GetOverflowFormattedTextArea(); I do not add this overflowtextArea to the page. - I want to use overflowtextArea.Text to put it in a second FormattedTextArea , but this also throws an error. Onno

Re: Wrap around image

Support · Nov 13, 2013
Hello Onno, Yes, it is not possible to read the over flow text of the FormattedTextArea using our DynamicPDF Generator for .NET product. Also as we mentioned in our last posting it is not possible to warp the text around image using only one FormattedTextArea. You can try using the TextArea and this will allow you to wrap the text around image. Thanks, ceTe Software Support Team.

Re: Wrap around image

Forum member · Nov 13, 2013
Hello, I did see you mentioned that is't not possible to wrap the text around an image using a FormattedTextArea. TextArea is not an option. With a TextArea I'm losing al formating like underlined, bold and italic words. thanks

Re: Wrap around image

Support · Nov 14, 2013
Hello, Currently we do not have any work around for achieving the text wrapping around image using single FormattedTextArea page element. The only way to achieve this is to add text using separate FormattedTextArea objects around image. Thanks, ceTe Software Support Team.

Re: Wrap around image

Forum member · Nov 14, 2013
Ok, thanks for the info. Unfortunately, using multiple FormattedTextArea is not an option because it's not possible to split the text. I'm getting the text from another component from our CMS. It would be nice if in future an GetOverflowText funntion like in the normal TextArea also will be available in the FormattedTexArea. Thanks, Regards, Onno

Re: Wrap around image

Support · Nov 14, 2013
Hello Onno, We will add this feature to our wish list and we may add this to our future version of DynamicPDF for .NET product but we not have any exact time line on this. Thanks, ceTe Software Support Team.