How to put text in rectangle using pdfbox and java/groovy

36 views Asked by At

Content stream through I wants to show "X" text in the rectangle (the rectangle is from form pdf as default), but the rectangle cover the "X" like this

enter image description here

I try to get the text "X" in a rectangle in using this code but the rectangle covers the text.

 contentStream.setNonStrokingColor(0)
 contentStream.beginText()
 contentStream.newLineAtOffset(104, 390)
 contentStream.setNonStrokingColor(0, 0, 0)
 contentStream.showText("X")
 contentStream.endText()
0

There are 0 answers