Image alignment in text?

前端 未结 1 1532
南方客
南方客 2020-12-20 13:47

Using iTextSharp i\'m trying to align an image so that it gets embedded in a paragraph. I can do it like this:

iTextSharp.text.Image image;
image.Alignment =         


        
相关标签:
1条回答
  • 2020-12-20 14:02

    The Phrase and the Paragraph objects do behave differently. Try changing to:

    image.Alignment = 6;
    document.Add(image);
    document.Add(new Phrase("Large string of text goes here"));
    

    This worked for me in VB. ( I had to change the image alignment to the sum of the integer values for ALIGN_RIGHT and TEXTWRAP to get this to work properly).

    ALIGN_RIGHT = 2
    TEXTWRAP = 4
    

    Your image was displayed at the top of the page because it was the first thing added to the document, and the text was added after it. You can move the image down by either setting its absolute position, or by adding some of your text to the document, then adding the image, then adding the rest of your text.

    0 讨论(0)
提交回复
热议问题