PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Images with overlaid text in a table
http://forum.pdfsharp.com/viewtopic.php?f=2&t=4040
Page 1 of 1

Author:  cmdrew [ Mon Nov 04, 2019 11:06 am ]
Post subject:  Images with overlaid text in a table

Hoping for some help as I'm fairly new to MigraDoc and PDF Sharp.

I have a table which is displaying a calendar so each cell in the table has text which is the day of the month. Some cells need to have an image added to them to show an event is taking place for that date. I have seen a few articles which seem to suggest a number of different methods including text frames but so far I have been unable to get any to actually display what I want - for example a red circle with a number in it which seems simple enough. I have previously got water marks to work so I thought I would check out that approach. My code is

paragraph = row.Cells(0).AddParagraph()
formattedText = paragraph.AddFormattedText(CStr(Day(caldate)).PadLeft(2, "0"), TextFormat.NotBold)

' Yes there is an event for this day
Dim imagefile As String = HttpContext.Current.Server.MapPath("./images/event.png")
Dim myImage As Shapes.Image = paragraph.AddImage(imagefile)
myImage.Top = Shapes.ShapePosition.Top
myImage.WrapFormat.Style = Shapes.WrapStyle.Through
myImage.LockAspectRatio = True

However this shows the text above the image - I have tried various extra flags for alignment etc but none give the required effect of placing the text on top of theimage. Any suggestions please?

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