CFPDFForm Populate Error - java.lang.NullPointerException: Platform, Locale, and Platform Name must not be null

1.5k views Asked by At

I've been banging my head against the wall trying to figure out the cause of the error below.

enter image description here

All I'm doing is running this very simple CFPDFFORM to populate a PDF form.

<cfset source = expandPath("Customer.pdf")>
<cfpdfform action="populate" source="#source#">
    <cfpdfformparam name="Name" value="John Doe">
    <cfpdfformparam name="Address" value="123 Test Cir">
    <cfpdfformparam name="City" value="Some City">
    <cfpdfformparam name="State" value="Some State">
    <cfpdfformparam name="Zip" value="11111">
    <cfpdfformparam name="Phone" value="123-456-7890">
</cfpdfform>

I've done a lot of searches and found very few people talking about this error. The one page that I found was ColdFusion CFPDFFORM does not populate PDF form fields. I tried the idea of going through my fonts and looking for corrupted ones. I even used a program called Fix Fonts Folder (http://fix-fonts-folder.en.softonic.com/) which was able to locate some corrupt fonts. But even then, I still get the error. So, I'm desperately looking for an answer.

Just in case, I'm running ColdFusion 10 Update 9 on Windows 7.

Thanks in advance.

4

There are 4 answers

0
Peruz Carlsen On BEST ANSWER

The workaround on the reported bug solved the issue. Thanks Miguel-F

The workaround is: "delete all fonts installed with the same date as your creative cloud 6 app installations or uninstall creative could 6"

0
Jesse Carlton On

I wrote a script that will parse all the font files in c:\windows\fonts and report back on the bad ones:

<cfset fontobj = createobject("java","com.adobe.fontengine.fontmanagement.FontLoader")>
<cfdirectory action="list" directory="c:\windows\fonts" name="fontdir">
<table border="1" style="border-collapse:collapse">
  <tr>
    <th>Font Name:</th>
    <th>Error</th>
  </tr>
  <cfloop query="fontdir">
  <cftry>
    <cfset loaded = fontobj.load(createobject("java","java.net.URL").init("file:///C|/windows/fonts/#fontdir.name#"))>
    <cfif arraylen(loaded) gt 0>
      <cfset dummy="#loaded[1].getPlatformFontDescription()[1].toString()#" >
    </cfif>
    <cfcatch>
      <cfif findnocase("platform",cfcatch.message)>
        <tr>
          <td><cfoutput>#fontdir.name#</cfoutput></td>
          <td><cfoutput>#cfcatch.message#</cfoutput></td>
        </tr>
      </cfif>
    </cfcatch>
  </cftry>
  </cfloop>
</table>
2
BizNuge On

I had the same issue too right after the installation of CS6.0.

Platform:

  • CF9.0
  • Win 7
  • CS6 (obviously)

Through trial and error, as stated above and a good few restarts of coldfusion I've whittled it down to the following font files that you can uninstall via font manager by going to C:\Windows\Fonts :-

  • AdobeNaskh-Medium.otf
  • MyriadArabic-Bold.otf
  • MyriadArabic-BoldIt.otf
  • MyriadArabic-It.otf
  • MyriadArabic-Regular.otf

Hope this helps someone. Took me a fair few hours to fix this "niggle".

1
SimonDau On

had the same issue myself.

My solution (which compliments the above correct answer): Here's the list of fonts that Adobe installs with the Creative Suite 6: http://www.adobe.com/type/browser/fontinstall/cs6installedfonts.html

  1. Copy all these fonts to the separate folder and remove from the Windows/Fonts directory.
  2. Test CFPDFFORM bit and confirm it's working
  3. Manually add them back.

In my case it turned out none of those fonts were corrupt per se, though probably weren't installed the way Windows like it. Re-installing it manually somewhat fixed the issue.

One more note: I've removed all until MyriadPro (including it) constantly refreshing the page containing CFPDFFORM bit until it worked. So for those trying to get a fast fix, I'd recommend starting with MyriadPro family. It just may turn out it's the one that breaks the things.

Hope this helps someone out!

/////////////// UPDATED 7/02/2014 ///////////////////////////////////////////////////////////////////

It turns out I am not able to comment until certain number of points will be acquired, therefore I'm not able to say how much Jesse Carlton's answer (above) helped me out.

Here's one more step that solved me the bug:

  1. It turns out that some of the Adobe installed fonts have name values as null, hence failing the cfpdfform badly. To find those files use the script that Jesse Carlton created (again, it's above in one of the answers)

  2. At least in my case all those fonts had duplicate values (normal and _0 ones). Normal values were visible and easy to remove using Windows font manager. However, the _0 ones weren't visible.

  3. Download software like FontExpert2014 (or any other font manager for that matter) and locate those files that you couldn't see in the windows font manager.

  4. To check whether all of the corrupt fonts are removed run the script from the step 1 again. When you'll get the empty table, try cfpdfform bit that was failing you previously and all should be good.

*the software from the step 3 was downloaded as evaluation version and did the trick for me.