Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
395 views
in Technique[技术] by (71.8m points)

java - Draw a rectangle in a PDF document using iText

Is there a way in iText to draw a rectangle in a PDF document?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Here is the solution. Thanks Dylan McClung.

PdfWriter writer = ...;
PdfContentByte cb = writer.getDirectContent();
cb.saveState();
cb.setColorStroke(Color.black);
cb.rectangle(x,y,x1,y1);
cb.stroke();
cb.restoreState();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...