我使用ColdFusion 11和Java (com.lowagie.text.pdf.PdfStamper)来填充pdf,但是当我用单个撇号(如32' )输入一个值时,它只将pdf保存为32而不是32'。该值将进入PDF中的多行文本区域。我试过了是否启用了富文本。
我试过用';、''、'和\u0027;取代';,但它们都消失了。我也尝试过xmlFormat,但它显示为'。
从MS复制和粘贴’也不能作为替换值。
这是我正在使用的代码
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 );发布于 2015-04-15 21:02:14
问题的结果是,被选中作为输入框的字体的Times字体没有撇号字符。将字体改为Arial或Verdana解决了问题。
https://stackoverflow.com/questions/29637803
复制相似问题