Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 682
Peruz Carlsen Avatar asked Dec 07 '22 08:12

Peruz Carlsen


2 Answers

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>
like image 158
Jesse Carlton Avatar answered Jan 05 '23 23:01

Jesse Carlton


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".

like image 38
BizNuge Avatar answered Jan 06 '23 01:01

BizNuge