首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用PDFStamper时缺少单引号

使用PDFStamper时缺少单引号
EN

Stack Overflow用户
提问于 2015-04-14 21:34:16
回答 1查看 190关注 0票数 5

我使用ColdFusion 11和Java (com.lowagie.text.pdf.PdfStamper)来填充pdf,但是当我用单个撇号(如32' )输入一个值时,它只将pdf保存为32而不是32'。该值将进入PDF中的多行文本区域。我试过了是否启用了富文本。

我试过用&#39&#59;''&apos&#59;\u0027;取代&#39&#59;,但它们都消失了。我也尝试过xmlFormat,但它显示为&apos&#59;

从MS复制和粘贴也不能作为替换值。

这是我正在使用的代码

代码语言:javascript
复制
this.pdfFile = this.pdfService.read( source=infile );
this.pdfReader = createObject("java","com.lowagie.text.pdf.PdfReader").init( tobinary( this.pdffile ) );
this.pdfWriter = createObject( "java", "java.io.FileOutputStream").init( CreateObject( "java", "java.io.File" ).init( this.outfile ));
this.pdfStamper = createObject( "java", "com.lowagie.text.pdf.PdfStamper").init( this.pdfReader, this.PdfWriter );
this.acroForm = this.pdfStamper.getAcroFields();
//this.misc.text = replace( this.misc.text, "'", "&##39;", "all");
//this.misc.text = replace( this.misc.text, "'", "\u0027;", "all");
//this.misc.text = replace( this.misc.text, "'", "’", "all");
//this.misc.text = replace( this.misc.text, "'", "'", "all");
//this.misc.text = PreserveSingleQuotes( this.misc.text );
this.acroForm.setField("text", this.misc.text );
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-15 21:02:14

问题的结果是,被选中作为输入框的字体的Times字体没有撇号字符。将字体改为Arial或Verdana解决了问题。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29637803

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档