javapdfbox

PDFBOX : U+000A ('controlLF') is not available in this font Helvetica encoding: WinAnsiEncoding


When trying to print a PDF page using Java and the org.apache.pdfbox library, I get this error:

PDFBOX : U+000A ('controlLF') is not available in this font Helvetica encoding: WinAnsiEncoding


Solution

  • [PROBLEM] The String you are trying to display contains a newline character.

    [SOLUTION] Replace the String with a new one and remove the newline:

    text = text.replace("\n", "").replace("\r", "");