使用PDFStamper时缺少单引号

Aar*_*ron 5 java pdf coldfusion

我正在使用ColdFusion 11和Java(com.lowagie.text.pdf.PdfStamper)来填写pdf,但是当我输入一个带有单个撇号的值时,32'它只会保存在pdf 32而不是32'.该值将进入PDF中的多行文本区域.我已尝试启用和不启用富文本.

我试着更换'&#39&#59;,'',&apos&#59;,和\u0027;,但他们都消失了.我也尝试了,xmlFormat但它显示为&apos&#59;.

从MS Word 复制和粘贴不能作为替换值.

这是我正在使用的代码

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 );
Run Code Online (Sandbox Code Playgroud)

Aar*_*ron 1

问题最终是选择作为输入框字体的 Times 字体没有撇号字符。将字体更改为 Arial 或 Verdana 解决了该问题。