I found that OpenPDF's Image.class
seems to have only 6 image positioning methods, and among them, there is only the option to add the image below the text (that is Image.UNDERLYING
), but there is no option to let the image float above the text.
The source code of OpenPDF's Image class is as follows:
public static final int DEFAULT = 0;
public static final int RIGHT = 2;
public static final int LEFT = 0;
public static final int MIDDLE = 1;
public static final int TEXTWRAP = 4;
public static final int UNDERLYING = 8;
I want to implement the function of editing the contract. It needs to put a seal image on top of the text, and the position of the image needs to be dynamically set (because the length of the contract text may change). This may involve pagination and absolute positioning. I found that the PdfContentByte
class seems to be able to add images to the text, but I don't know how it can dynamically position the images. It would be nice if there was a way to do this in sequence with Document#add
like the Paragraph
class, but I haven't found it yet.
The effect I want to achieve is roughly like this: Click to view the picture
How can I achieve my needs?