« Return to Thread: Writting Text on Images

Re: Writting Text on Images

by Elrinth :: Rate this Message:

Reply to Author | View in Thread

I'm not sure what your trying to do exactly.
But use the PdfContentByte and write the text the last thing you do in the document page. That which is added last will come up in the upmost layer.
example:
PdfContentByte cb = writer.DirectContent; // writer is grabbed from the PdfDocument
// writing text
        cb.BeginText();
        cb.SetFontAndSize(bf, 12); // bf is a BaseFont
        cb.SetColorFill(new Color(0x33, 0x33, 0xff));
        cb.SetTextMatrix(45, 740); // x counted from left... y counted from bottom of page and up.
        cb.ShowText("This is my text"); // set position in document
        cb.EndText();

Oh and there's also layers, I haven't tried using them myself, but maybe you can use them and set some z-index with them?

Kind regards, Elrinth

 « Return to Thread: Writting Text on Images