codeforamerica / pdfhook

A Python web application for converting PDF forms into PDF-filling APIs

Home Page:https://pdfhook.herokuapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document supported field types

bengolder opened this issue · comments

PDF Form Field types

  • Textbox field
  • Checkbox
  • Radio Button
  • List of choices (currently getting an error when filling)
  • Dropdown list (currently getting an error when filling)
  • Signature (not planning to support)

#41 exposed some more details regarding the support of different field types. Here are some observations from those attempts.

Overall PDF creation tips

  • Unicode seems to be fine everwhere except as a value in Checkboxes or Radio Buttons
  • Custom export values seem to cause problems for multiple field types, and should probably just be avoided.
  • If two fields share the same name, it causes some surprising errors. Name conflicts between fields should be avoided.
  • Text styles and appearance data is not captured

Checkboxes: "Button" screen shot 2016-03-12 at 6 30 25 pm

  • Always list their options as the export value plus "Off". With no custom export value, the default options for Checkboxes are: ["Off", "Yes"]
  • Do not seem to be able to support Unicode as a custom export value. Can they handle Unicode in their field names?
  • Unclear if it one can find out whether the field is checked by default. But there are always only two options, never a third.
  • The field value is not enclosed in parenthesis in the fdf file.

Radio Buttons: "Button" screen shot 2016-03-12 at 6 30 30 pm

  • These are groups of mutually exclusive options.
  • Each group of radio buttons shows up as one field.
  • The list of options is always the set of choices (usually just the names of the individual buttons) plus "Off". For example, ['Choice1', 'Choice2', 'Choice3', 'Off']
  • If two buttons in a group share the same name, indices will be added to the set of available options. The index of the selected button will be displayed as the field value in the data dump, but the fdf will show the name as the value (despite the consequent ambiguity).

List Boxes: "Choice" screen shot 2016-03-12 at 6 31 15 pm

Dropdowns: "Choice" (AKA Combo Box) screen shot 2016-03-12 at 6 32 49 pm

Text: "Text" screen shot 2016-03-12 at 6 31 24 pm

  • Seems to do fine with unicode field names and values
  • Didn't seem to have any trouble.