在java中对齐AcroFields [英] Align AcroFields in java

查看:510
本文介绍了在java中对齐AcroFields的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用iTextSharp将数据填充到PDF模板,这是在OpenOffice中创建的。它填写得很好,我得到了正确的PDF。在那个PDF中,一些摘要将会到来,我希望那个地方与模板对齐。

I'm using iTextSharp to populate the data to PDF Templates, which is created in OpenOffice. it populating fine, I'm getting proper PDF. In that PDF some where summary will come, that place i want align that text against the Template.

我在代码下面做但不起作用。

I'm doing below code but it does not work.

fields.setFieldProperty(fieldName, "fflags", PdfFormField.Q_LEFT, null);

请帮助。

谢谢。

Please Help.
Thanks.

推荐答案

假设你有一个纯粹的AcroForm而不是我在评论中指出的混合形式,这就是你改变字段四边形的方法:

Assuming that you have a pure AcroForm and not a hybrid form as I indicated in my comment, this is how you change the quadding of a field:

AcroFields form = stamper.getAcroFields();
AcroFields.Item item;
item = form.getFieldItem("fieldLeft");
item.getMerged(0).put(PdfName.Q, new PdfNumber(PdfFormField.Q_LEFT));
item = form.getFieldItem("fieldCenter");
item.getMerged(0).put(PdfName.Q, new PdfNumber(PdfFormField.Q_CENTER));
item = form.getFieldItem("fieldRight");
item.getMerged(0).put(PdfName.Q, new PdfNumber(PdfFormField.Q_RIGHT));

由于您错误地假设,四边形不是字段标志的一部分。这是小部件注释字典的输入。

The quadding isn't part of the field flags as you wrongly assumed. It's and entry of the widget annotation dictionary.

这篇关于在java中对齐AcroFields的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆