Missing single quote when using PDFStamper

I use ColdFusion 11 and Java ( com.lowagie.text.pdf.PdfStamper ) to populate pdf, but when I enter a value with one apostrophe, for example 32' , it only saves in pdf format as 32 instead of 32' , The value goes into multi-line text area in PDF. I tried with and without rich text included.

I tried replacing ' with '&#59; , '' , &apos&#59; and \u0027; but they all disappear. I also tried xmlFormat , but it displays as &apos&#59; .

Copy and paste from MS Word did not work as a replacement value.

Here is the code I'm using

 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 ); 
+5
source share
1 answer

The problem was that the Times font, selected as the font for input fields, did not have an apostrophe character. Changing the font in Arial or Verdana fixed the problem.

+1
source