Justify text with Acrofields

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Justify text with Acrofields

Hello guys,
I am filling a PDF document (one I read as empty but with some created fields) using Acrofields. Somethin like:

        PdfStamper pdfStamper = new PdfStamper(pdfReader, Response.OutputStream);

        // Get the form fields
        AcroFields form = pdfStamper.AcroFields;

I can align the text to the right doing this:

        AcroFields.Item item = form.GetFieldItem(field);
        PdfDictionary widget = (PdfDictionary)item.GetWidget(0);
        PdfDictionary merged = (PdfDictionary)item.GetMerged(0);
        PdfNumber align = new PdfNumber(PdfFormField.Q_RIGHT);
        widget.Put(PdfName.Q, align);
        merged.Put(PdfName.Q, align);

But how can I justify the text? Like here: http://thewebmadeeasy.com/AtomsNetwork/Files/352/alignedvjustified_S.png

I have seen in the documentation that it can be done when you use PdfCell, but since Im not using it because Im filling fields in a template I dont know how to do it

Thanks a lot,D