“Expected dict” Errors in FDF Acrobat Forms

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.

in View Kelson Vibber's profile on LinkedIn

16 thoughts on ““Expected dict” Errors in FDF Acrobat Forms

  1. Charles

    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.

    Reply
  2. Keoki

    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?

    Reply
  3. Brian S

    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!

    Reply
  4. Barbara

    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.

    Reply
  5. Domingo

    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

    Reply
  6. Caz

    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?

    Reply
  7. Allan

    I was having this issue too, and it was driving me crazy for over an hour. I am generating an FDF file in a PHP page, and churning it out plain text with an vnd.fdf header. But the problem I was running into when I was getting the “Expected dict” error was that I was using Dreamweaver that had tag close autocomplete on. So when I opened the <” for me. How lovely. I started comparing a PHP generated FDF file and a Reader generated FDF file, and the only difference was that lone “>” at <. I took it out manually, and hurrah, it’s working beautifully.

    Solved! Thanks for the blog, I wouldn’t have figured out where to even look.

    Reply
  8. Allan

    To clarify my post, as it was edited to remove html tags(a sentence was also removed in the process), FDF tags are opened with: <</FDF

    A > was generated by Dreamweaver. Make sure that if you use a WYSIWYG editor, that tag close autocomplete options aren’t enabled when working with plaintext FDF generation.

    Reply
  9. JENNIFER

    Just thought you should know that this post is still relevant!!! I sure was happy to find out that the problem I was having was due to a salesperson put a smilie in my form field!!!

    Reply
  10. Monique

    Wondering if anyone has experienced the “expected a dict” problem when not dealing with a form-fill pdf, or a web opened document? I added scanned pdf format pages to an existing pdf document, they inserted in a bizarre format – very, very, tiny, smaller than a postage stamp – and now I cannot delete them.

    Reply
    1. Erik

      Monique,
      we have almost the same problem here.
      our users have PDF documents wich they need to provide with a Titlepage. The titelpage is made out of 2 Stamps.
      When they try to combine the 2 files, PDF gives a ‘expected a dict object’.

      Normal we would click ok, and think everything went wrong, and call some kind of helpdesk.

      But when you try to combine the files, and you get the ‘expected a dict object’ message you clik ok. THEN SAVE the document. and close the original.

      Now open the combined PDF file, you will see that the title page is there!……

      curious case, if there’s someone who had the same problem, please Reply or e-mail me.

      (i’m sorry for my bad english)

      Reply

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.