Tryed 2 diferent ways:
-------------------------------------------------------------------------
st = PdfStamper.CreateSignature(reader, fs, '\0', null, true);
BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252,
BaseFont.NOT_EMBEDDED);
st.SignatureAppearance.GetAppearance().BeginText();
st.SignatureAppearance.GetAppearance().SetFontAndSize(bf, 20);
st.SignatureAppearance.GetAppearance().ShowTextAligned(PdfContentByte.ALIGN_CENTER,
"This text is centered", 250, 700, 0);
st.SignatureAppearance.GetAppearance().EndText();
this one, despite i make SetFontAndSize... says that "before writing any
text you need to set font and size"
-------------------------------------------------------------------------
-------------------------------------------------------------------------
st = PdfStamper.CreateSignature(reader, fs, '\0', null, true);
PdfTemplate t = st.SignatureAppearance.GetLayer(2);
BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252,
BaseFont.NOT_EMBEDDED);
t.BeginText();
t.SetFontAndSize(bf, 20);
t.ShowTextAligned(PdfContentByte.ALIGN_CENTER, "This text is centered", 250,
700, 0);
t.EndText();
st.Close();
Debuging the code, when it executes the st.close(), gives out the following:
{System.NullReferenceException: Object reference not set to an instance of
an object.
at iTextSharp.text.pdf.PdfRectangle..ctor(Rectangle rectangle)
at iTextSharp.text.pdf.PdfFormXObject..ctor(PdfTemplate template)
at iTextSharp.text.pdf.PdfTemplate.get_FormXObject()
at iTextSharp.text.pdf.PdfWriter.AddSharedObjectsToBody()
at iTextSharp.text.pdf.PdfStamperImp.Close(Hashtable moreInfo)
at iTextSharp.text.pdf.PdfSignatureAppearance.PreClose(Hashtable
exclusionSizes)
at iTextSharp.text.pdf.PdfSignatureAppearance.PreClose()
at iTextSharp.text.pdf.PdfStamper.Close()
Post by Paulo SoaresUse the template returned from PdfSignatureAppearance.GetLayer(2) to
draw whatever you like.
Paulo
-----Original Message-----
On Behalf Of KrazySmile
Sent: Monday, November 05, 2007 10:55 AM
Subject: Re: [itextsharp-questions] Signature Alignment
Sorry about that, didnt know about that.
I checked it, and i cant find anything.
Is this explained in the book? i have bought the book last
week, but cant
find info about this.
Regards.
Post by Paulo Soares-----Original Message-----
On Behalf Of KrazySmile
Sent: Monday, November 05, 2007 9:22 AM
Subject: [itextsharp-questions] Signature Alignment
Hey everyone.
Im trying to set the signature alignment to ALIGN_RIGHT.
It can't be done that way. You'll have to create the appearance
yourself. See the source of PdfSignatureApperance.cs.