PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

Image positioning in paragraph
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2563
Page 1 of 1

Author:  huwyss [ Fri Aug 30, 2013 7:55 pm ]
Post subject:  Image positioning in paragraph

Hi

I'm trying to place an image in a paragraph. But I seem to not be able to position the image where I would like to

Here is the code:

Code:
Paragraph paragraph = m_document.LastSection.AddParagraph();
FormattedText formattedText = paragraph.AddFormattedText(textstring);
Image image = paragraph.AddImage(imageFileName);
image.Width = "1cm";
image.RelativeVertical = RelativeVertical.Line;
image.Top = ShapePosition.Center;
image.Left = ShapePosition.Left;


That is the result:

Attachment:
File comment: This is what I get
actual.jpg
actual.jpg [ 10.87 KiB | Viewed 8402 times ]


Here is what I would like to have:

Attachment:
File comment: The goal
goal.jpg
goal.jpg [ 11 KiB | Viewed 8402 times ]


I searched for infos. I tried different variations of the RelativeHorizontal, RelativeVertical, ShapePosition, WrapFormat.Style. But the images are always aligned with the bottom of the text.

What am I not getting? What am I not doing right?

Best regards
Hans

Author:  Thomas Hoevel [ Mon Sep 02, 2013 5:01 pm ]
Post subject:  Re: Image positioning in paragraph

I would use a table with two columns, one column for the text, one column for the images.

See also:
viewtopic.php?p=7212#p7212

You can use tables without borders, so you would get what you want.

Author:  huwyss [ Wed Sep 04, 2013 5:34 pm ]
Post subject:  Re: Image positioning in paragraph

Thank you for your answer.

Regards,
Hans

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/