iTextSharp - Text overlapping image

前端 未结 2 952
故里飘歌
故里飘歌 2021-01-20 07:29

I\'m using iTextSharpText to build a PDF.

I was asked to add some dynamic text over an image. I\'ve already tried some examples that I found on this forum and other

2条回答
  •  再見小時候
    2021-01-20 08:14

    I stumbled across a solution while trying to resolve this issue for my own needs. I created a Table object and defined multiple columns. The first column was set to a minimum width, and the rest the appropriate widths to position text being positioned on the form. I am producing an image about 1"x7". The image was added to the cell in the first column of a table row. It's dimensions as set by SetAbsoluteHeight and SetAbsoluteWidth far exceeded the size of the column, so the image kind of bled into/under the remaining columns of the row. For the text being overlaid onto the image, column widths, adding Chunk.Newlines, and paragraph SetLeading (to effect line spacing) were used to adjust text positioning.

提交回复
热议问题