1

I need add a line for sign in my document pdf with Itex java. But i don't meet like do it.

I need the following:

(The text of my document).......................


name people. here: a line for that the people can signing

julio izquierdo
  • 75
  • 1
  • 14

1 Answers1

2

When you say a line for sign, you confuse people because you are probably not talking about a digital signature. If you were, you'd not ask for a line, but for a rectangle that defines the signature field. For more info about digital signatures, read the free ebook Digital SIgnatures for PDF documents.

One could rephrase your question to "how do I add a line where people can place a wet signature?" But that would be a bad quesion too: your question isn't about signatures at all. Your question is about adding a dotted line.

That's a question that has been answered in another free ebook: The Best iText Questions on StackOverflow. In this book, you'll find these questions:

Although these examples may not be "on topic" at first sight, they all have the DottedLineSeparator in common in their answer.

Either you want something like this:

Paragraph p = new Paragraph("                            ");
DottedLineSeparator dottedline = new DottedLineSeparator();
dottedline.setOffset(-2);
dottedline.setGap(2f);
p.add(dottedline);
document.add(p);

This creates a Paragraph consisting of white space that is underlined with a dotted line.

Or you want something like this:

Chunk linebreak = new Chunk(new DottedLineSeparator());
doc.Add(linebreak);

This creates a full dotted line (and the answer from which I've taken this snippet explains how to tweak the length of the line).

Or you want something like this:

Paragraph p = new Paragraph("Please sign here: ");
p.add(new Chunk(new DottedLineSeparator()));
p.add("(wet ink signature)");
document.add(p);

Your question is too unclear to assess which of the above would be the best solution, but I'm sure you'll figure that out once you decide to read the documentation.

Community
  • 1
  • 1
Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165