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

Moving an image in a paragraph
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3564
Page 1 of 1

Author:  ChrisSabau85 [ Thu Mar 30, 2017 5:24 pm ]
Post subject:  Moving an image in a paragraph

Hi

i have an image and some text that needs to stay in line. If the text is long, then i need it to line break under the image label. See attached photo (The screenshot is a pdf render, I just used ms paint to edit the screenshot show what I need. )

But my problem is, the image is sitting a bit to high and i want to move it down a bit. How can i accomplish that?

Here is my code:
Code:
          var table = section.AddTable();
          table.AddColumn(Unit.FromInch(7.5));

          Image image;
          var imageTextRow = table.AddRow();
          var imageTextCell = imageTextRow.Cells[0];

          Paragraph logoAndTextParagraph = imageTextCell.AddParagraph();
          image = logoAndTextParagraph.AddImage(@"C:\Users\csabau\Downloads\HcmcPdfSpike\HcmcPdfSpike\Content\labeltest.png");
          logoAndTextParagraph.AddFormattedText(" This is some information. This is some information. This is some information. This is some information. This is some information. This is some   information. This is some information. This is some information. This is some information.  ", _font);
          image.Height = new Unit(12, UnitType.Point);


Attachments:
File comment: Expected vs reality
testPDF_Expected Result.png
testPDF_Expected Result.png [ 99.57 KiB | Viewed 3495 times ]

Author:  TH-Soft [ Sat Apr 01, 2017 6:01 am ]
Post subject:  Re: Moving an image in a paragraph

Hi!

Images in paragraphs are treated like text and are by default aligned at the baseline of the text.
I don't know if it is possible to move the images down a bit - the Image class has many position options that are worth a try.

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