pdfftk表格填充字体调整大小 [英] Pdftk form filling font resize

查看:230
本文介绍了pdfftk表格填充字体调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用pdftk将输入内容填写为pdf格式. 我没有问题可以生成XFDF文件并合并数据&模板, 但有时该值比字段长,并且文本被剪切.

I'm using pdftk to fill inputs in a pdf form. I have no problem to generate a XFDF file and merge data & template, but sometimes the value is longer than the field, and the text is just cut.

有没有一种方法可以动态地调整字体,或者可以防止字体被剪切? PDF生成将是app的重要组成部分,我对错误的值将被发送的风险深感震惊.

Is there a way to adapt the font dynamically, or something to prevent it to be cut? The PDF generation will be an important part of the appa, and i'm affraid about the risks that wrong values will be sent.

最佳实践是什么? 谢谢

What are the best pratices ? Thanks

推荐答案

它没有剪切,只是没有显示.文本字段可以可滚动.然后,如果文本不合适,则在字段的角落会显示一个可视指示符,例如阅读器,但这可能不是您想要的.

It's not cut, it's just not shown. Text field can be scrollable. Then, if text doesn't fit, there's visual indicator in field's corner, in e.g. Reader, but that's probably not what you want.

文本字段可以具有 automatic 字体大小,然后,我认为,最佳实践是设置字段高度,以便它限制短字符串(甚至是单个字符)的文本字体大小,并且字体大小仅在字符串长度超过字段大小时才开始更改(减小).

Text field can have automatic font size, and then best practice, I think, would be to set field height so that it limits text font size for short strings (even for single character), and font size only starts changing (diminishing) when string length exceeds field size.

在字段字典的默认外观 /DA条目(或其父级,因为此属性是可继承的)中,字体大小由零字体大小设置,如下所示:/Helv 0 Tf 0 g

Automatic text size is set by zero font size in default appearance /DA entry of field dictionary (or its parent, because this property is inheritable), like this: /Helv 0 Tf 0 g

但是,您当然可以对合并的PDF进行后处理:计算字符串长度并调整有问题的字段的字体大小.

But, of course you can post-process merged PDF: calculate string length and adjust font size of offending fields.

这篇关于pdfftk表格填充字体调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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