4

I have a little script that creates a PDF using <cfdocument> to write a PDF. It looks something like this (minimalized code):

<cfdocument name="mypdf" format="pdf">
    &#9746;
</cfdocument>

When my data includes high ASCII chars like &#9744; (☑) I get an error:

An exception occurred when performing document processing.

The detailed error msg is:

The cause of this exception was that: coldfusion.document.spi.DocumentExportException: coldfusion.document.DocumentFontException: An exception occurred when reading the font file c:\windows\fonts\EUB___.PFM The cause of this exception was that: java.awt.FontFormatException: Unsupported sfnt C:\WINDOWS\TEMP+~JF42977.tmp..

This seems to be a font-problem! Changing the CSS Font doesn't solve the problem. I need to check the default system font...

Oh and it's not the #, I already did this: &##9744;

I use ColdFusion 8.

Dollique
  • 952
  • 2
  • 10
  • 29
  • does the data include the actual ascii or is it a special character like Microsoft's smart quotes or a smiley face? I've had to write a function that replaces stuff like a real smiley face with :). I called the function "unMicrosoft" lol. – genericHCU Dec 19 '12 at 12:36
  • It contains the ASCII like the one in my example `☐`. But the error also appears when the special Char is added like this `☑` (the ascii is the checkbox). – Dollique Dec 19 '12 at 12:55
  • Does the error occur if you output to html instead of pdf? – Dan Bracuk Dec 19 '12 at 15:05
  • The error only occures when I'm using ``. If I output my data in html without using it, it doesn't throw the error. – Dollique Dec 19 '12 at 15:17
  • It's definitely a problem with creating the PDF, we've run into it a lot as well, our solution was to remove the characters or replace them with something else. you could use reReplace to remove them if it is an option. – genericHCU Dec 19 '12 at 17:15
  • Can you update your question with the *full* error message - including stack trace? – Leigh Dec 19 '12 at 17:35
  • Toby, I agree with @DanBracuk in this response: there's perhaps more to this than meets the eye. Can you pls provide a complete and self-contained reproduction case. IE: not just a snippet of partial code with missing variable values etc, something that demonstrates the problem for you; and pare it down to be the absolute minimum code possible that still demonstrates the issue (this should always be part of your troubleshooting of problems like this, btw). Then we can copy & paste to see what happens on out machines. – Adam Cameron Dec 20 '12 at 07:04

1 Answers1

1

If I do this:

<cfscript>
x = "before_______ &##9744; __________after";
</cfscript>

<cfdocument format="pdf">
<cfoutput>#x#</cfoutput>
</cfdocument>

I get a pdf with "before_______after" as the content.

The problem may lie elsewhere in your code.

Dan Bracuk
  • 20,699
  • 4
  • 26
  • 43
  • Interestingly, whilst I don't get an error, I don't get the "ballot box" character displaying either. So this all seems a bit flaky to me. CF 8.0.1 on Win 7 64-bit, running the default JVM. – Adam Cameron Dec 20 '12 at 07:01
  • I just found out that it may is a font problem. I can display all chars to `և`. I checked the full error msg **An exception occurred when reading the font file c:\windows\fonts\EUB_____.PFM** I'll update the question with it! – Dollique Dec 20 '12 at 07:55