0

I need to add an image to every single line in my PDF. At the moment I am getting this:

Rectangle: 16x16 (rot: 0 degrees)Domain\administrator [Allow] 
Rectangle: 16x16 (rot: 0 degrees)Domain\User1 [Allow]
Rectangle: 16x16 (rot: 0 degrees)Domain\User2 [Allow]

My app searches directories and display's user rights to the folders searched It saves it to a text file where I then red from the text file and add to my PDF

var image1 = iTextSharp.text.Image.GetInstance(Resources.user, System.Drawing.Imaging.ImageFormat.Png);
List<string> dirf = new List<string>();
                        try
                        {
                            foreach (string dirfo in Directory.GetDirectories(location))
                            {
                                foldersCounted++;
                                document.Add(new LineSeparator(0.5f, 100, null, 0, -5));
                                document.Add(new Paragraph(dirfo, font6));
                                string seperator = csvPermissions.Replace(", ", "\n" + image1);
                                document.Add(new Paragraph(seperator, font5));
                                document.Add(new Paragraph("\n"));
                                document.Add(new LineSeparator(0.5f, 100, null, 0, -5));

In this line string seperator = csvPermissions.Replace(", ", "\n" + image1); I have added the image1 and as you can see it outputs Rectangle: 16x16 (rot: 0 degrees)

I would like to have the image (which is a user icon) display next to each line showing user rights

Just wondering if this is possible and if so how can I achieve that?

Thanks

EDIT

This is what it gives me now:

`image`
     text text text text text
     text text text text text
     text text text text text

I would like to show:

 image text text text text
 image text text text text
 image text text text text
  • 1
    Suggestion: have you considered adding your images to Paragraph: https://stackoverflow.com/questions/11118224/itext-adding-external-image-using-chunk – paulsm4 Jun 06 '19 at 18:04
  • Hi, I did look at that but it does not work. it puts the image at top and then the the text starts underneath. Please see edit in question –  Jun 07 '19 at 05:30
  • I don't know if maybe because from the text file all text is in one line and separated by a `,` and then in my PDF I replace that `,` with `\n`. So maybe the PDF is seeing it as a complete paragraph instead of one line? –  Jun 07 '19 at 05:34

0 Answers0