Sci-fi, comics, humor, photos…it’s all fair game.

“Expected dict” Errors in FDF Acrobat Forms

October 24th, 2005 by Kelson. Posted in Troubleshooting, Web Design and tagged for , , , , , ,

Today I was trying to fix a problem in a section of a website that hadn’t been changed in roughly 5 years. The page in question retrieved data from a database and filled out an Acrobat form using FDF. Under some circumstances, Adobe Reader would generate an error message, “Expected a dict object.” Then it would freeze, and crash the web browser for good measure.

This site was built with ColdFusion, and used a then-freely-available library called PDFFormFiller.cfm (I can’t find any sign of it now) to generate the FDF code. After saving the offending FDF to a file (eliminating the browser as a factor), I started manually editing the code to see what happened.

The problem turned out to be parentheses appearing in the form data. FDF uses parentheses-delimited strings, and it was finding ) in the code and trying to parse what was left as FDF tokens. The solution was simple: just escape the parentheses as \( or \).

In this case, I changed this expression:

#Evaluate("VarStruct.#VarName#")#

to

#ReplaceList(Evaluate("VarStruct.#VarName#"),"(,)","\(,\)")#

I don’t know whether older versions of Acrobat Reader were more lenient about this or whether this site just never ran into anyone using parentheses before. Either way, there’s precious little useful information about this problem online. In case anyone else runs into it, this entry should help.

Related Posts

Also Related

  1. 9 Responses to ““Expected dict” Errors in FDF Acrobat Forms”

  2. By Doug on Nov 17, 2005

    Wavatar

    I also had the problem with a misplaced “>”. It seems that Acrobat 7 is much more picky with formatting.

  3. By Charles on Jan 16, 2006

    Wavatar

    Thanks, I ran accross this after experiencing a parenthesis problem (I wanted to make certain i could escape those characters with a \). Found you via google.

  4. By Keoki on Mar 7, 2006

    Wavatar

    Hello:

    I seemed to have the same error. As, I am new to FDF and populating PDF’s through an asp page, I have no idea what this error means. The FDF is within the ASP file, The funny part is it worked once… I changed a few attributes. And, whammy no luck.

    Any ideas?

  5. By Brian S on Apr 4, 2006

    Wavatar

    Thanks, I was going crazy trying to figure this error out. I googled the ‘Expected dict’ error and found this blog. Our site pulls fdf data from our dbase to populate a pdf form. Turns out users were entering parenthesis in a phone number field causing Adobe to hang and “crash the web brower for good measure”. Manipulated the php code to strip parenthesis and works great now!

  6. By Barbara on Apr 20, 2006

    Wavatar

    Found this on by googling expected a dict object. I am having an issue with a site that we just took over for a client that swears this used to work.

    problem is i program in cf and the site is built in asp. how do I do the escapes in asp.

    for example if i have a field
    writeField “ERPhone”,rs(”phone”)

    how would i do the escape for parentethis.

  7. By think_Man on Sep 25, 2006

    Wavatar

    Thanks for this blog I was also going crazy….

  8. By Domingo on Sep 29, 2006

    Results:
    1. “The file is damaged and could not be repaired”.
    2. “Expected a dict object.”

    Two problems occur when a form is submitted (Opened) with a single or close bracket in a textbox.

    Steps to reproduce bug:
    1. Single close Bracket “(” causes 1.

    2. Single open Bracket “(” causes 2.

    3. When an unpaired “)(” is used in a textbox causes 2.

    These files are either submitted or read in IE 6.0.

    One solution would be before submitting a form to run a js to change all “()” to “[]“.

    Domingo

  9. By Cliff on Aug 21, 2007

    Wavatar

    I get this error and I have no forms on my PDF. ANy ideas?

  10. By Caz on Nov 7, 2007

    Wavatar

    I have this message when trying to open documents from internet since downloading version 8, but not with all documents. I do not have a danny about brackets forms etc. just want access as I used to have. Should I go back to old version?

Post a Comment

Note: This post is over 3 years old. You may want to check later in this blog to see if there is new information relevant to your comment.