Skip navigation
Currently Being Moderated

PDF function error: "Platform, Locale, and Platform Name must not be null"

Nov 24, 2010 7:45 AM

I'm trying to read in a pdf form, complete the fields and send it to the user's browser. However I approach it, whenever I use a cfpdf type of tag, I get the error message "Platform, Locale, and Platform Name must not be null".

For example the following flags an error on the cfpdfformparam line:

<cfpdfform action="populate" source="Order Acknowledgement Form4.pdf">
    <cfpdfformparam name="Text1" value="Test Data">

What am I doing wrong?

Using CF9.01 Developer edition. The PDF was created in Acrobat X from a Word file.

The following works and lists the form field, so I'm guessing that it's not a problem with the source file.

<cfpdfform source="Order Acknowledgement Form4.pdf" result="resultStruct" action="read"/>
<cfdump var="#resultStruct#">
  • Currently Being Moderated
    Nov 15, 2012 1:26 PM   in reply to PaulS9

    I believe this is a font issue with the specific server being used. This is why the same code will work on the production server and not the testing server. I am experiencing the same issue and although I don't have a great solution here's what I learned.



    1. The stacktrace shows that there's an error getting the getPlatformFontDescription of an OpenType font.

    2. Our Windows server is listing some TrueType fonts as OpenType. Is yours?

    3. Using the following code corrected the issue:


            <cfpdf name="local.pdffile" action="read" source="some path" >
            local.pdfReader = createObject("java", "com.lowagie.text.pdf.PdfReader").init(tobinary(local.pdffile));
            local.outputStream = createObject("java", "").init();
            local.pdfStamper = createObject("java", "com.lowagie.text.pdf.PdfStamper").init(local.pdfReader,local.outputStream);
            local.Acroform = local.pdfStamper.getAcroFields();
            //Populating Form Fields
             // etc.
             local.pdfStamper.setFormFlattening(true); //optional
              local.pdffile = local.outputStream.toByteArray();
             <!--- flatten="no" must be set or you will get the error again  --->
             <cfpdf action="write" source="local.pdffile" destination="#variables.OutputPath##local.UUID#.pdf" overwrite="yes" flatten="no"  />


    4. Simply listing all the fonts available to the server using the Java subsystem also fails. Try this.

             <cfset list=createobject("java","com.adobe.internal.pdfm.util.FontSetBuilder")>
             <cfdump var="#list#">
             <cfset dummy = list.getPdfFontSet()>
             <cfdump var="#dummy.toString()#">
             <!--- this should fail --->



    5. We have "fixed" our problem at the moment by removing all the fonts in the Windows\Font folder, fixing or isolating any corrupt fonts, and reinstalling them. It's painstaking but seems to work.



    Good luck!

    Mark as:
  • Currently Being Moderated
    Jul 13, 2013 12:04 PM   in reply to PaulS9

    Hi, 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:


    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!

    Mark as:
  • Currently Being Moderated
    Dec 5, 2013 11:28 AM   in reply to PaulS9

    I've created a cfm page that enumerates all the fonts in the c:\windows\fonts directory and lists the ones that are incompatible with the CF PDF components:


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


        <th>Font Name:</th>



      <cfloop query="fontdir">


        <cfset loaded = fontobj.load(createobject("java","").init("file:///C|/win dows/fonts/"))>

        <cfif arraylen(loaded) gt 0>

          <cfset dummy="#loaded[1].getPlatformFontDescription()[1].toString()#" >



          <cfif findnocase("platform",cfcatch.message)>











    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points