A button the reader presses
Place a button that acts instead of answering: open an address, go to a page, send the form or reset it.
Summary
This is the button you press in a document shown on screen: “Send”, “Clear”, “Next page”. You write the word shown on it, and you may plan another for when the mouse passes over, and a third while it is held down. You can also put a small drawing on it, alone or beside the word, above it, below it, to its left or to its right.
Technically
Asked for with
"type": "push_button"
A button is an /FT /Btn field with the pushbutton bit set, the one field carrying no value at all: pressing it acts, and what it does is the action the request hangs on it. /MK has the three captions, which match the three states — /CA at rest, /RC under the pointer, /AC held down — and the last two, left out, take the resting one. The icon is the name of a drawing the request declared; how it sits in the box is set by an /IF fit dictionary, which says when to resize, whether to keep the proportions, and where the icon lands in the room left over. The layout picks between the word alone, the icon alone, and the five ways of pairing them.
Request schema
Required keys: name, a string; rect; font; font_size. Optional keys of the button itself: caption, rollover_caption, down_caption, strings (the last two, absent, take caption); layout, one of caption_only (default), icon_only, caption_below_icon, caption_above_icon, caption_right_of_icon, caption_left_of_icon or caption_over_icon; icon, rollover_icon, down_icon, names of declared drawings; icon_fit, an object of scale (always, when_bigger, when_smaller, never), stretch (proportional, anamorphic), leftover_left and leftover_bottom (numbers from 0 to 1, the two together) and ignore_border (a boolean at false); action, one of the ten actions described on the link page. Optional keys shared by every field: read_only, required, no_export, booleans at false; background; border (a required width, a color in light, a style); tooltip and description, strings, absent writing no such entry; mapping_name, a string, the name a submitted form reports the button under; flags, the flag word described on the text field page, absent printing the button and saying nothing else; triggers, one action per moment, the ten of them listed on the text field page; pages, default empty; relative_to. Cross refusals: leftover_left without leftover_bottom, and the other way round; a CMYK or named-space colour in border.color.
A whole request that creates a PDF
{
"standard_fonts": [{"name": "sans", "face": "helvetica"}],
"drawings": [
{
"name": "arrow",
"box": {"llx": 0, "lly": 0, "urx": 16, "ury": 16},
"items": [
{
"type": "line",
"from": {"x": 2, "y": 8},
"to": {"x": 14, "y": 8},
"stroke": {"width": 2, "color": [0.11, 0.31, 0.55]}
},
{
"type": "line",
"from": {"x": 9, "y": 3},
"to": {"x": 14, "y": 8},
"stroke": {"width": 2, "color": [0.11, 0.31, 0.55]}
}
]
}
],
"items": [
{
"type": "text_field",
"name": "order",
"rect": {"llx": 72, "lly": 740, "urx": 300, "ury": 762},
"font": "sans",
"font_size": 11
},
{
"type": "text_field",
"name": "notes",
"rect": {"llx": 72, "lly": 764, "urx": 300, "ury": 786},
"font": "sans",
"font_size": 11
},
{
"type": "push_button",
"name": "reset",
"rect": {"llx": 72, "lly": 700, "urx": 172, "ury": 722},
"font": "sans",
"font_size": 11,
"caption": "Clear the notes",
"border": {"width": 0.75},
"action": {"reset_fields": {"fields": {"only": ["notes"]}}}
},
{
"type": "push_button",
"name": "send",
"rect": {"llx": 184, "lly": 700, "urx": 300, "ury": 722},
"font": "sans",
"font_size": 11,
"caption": "Send the order",
"layout": "caption_left_of_icon",
"icon": "arrow",
"icon_fit": {
"scale": "when_bigger",
"stretch": "proportional",
"leftover_left": 0.5,
"leftover_bottom": 0.5
},
"border": {"width": 0.75},
"action": {
"submit_fields": {
"url": "https://hqf-pdf.com/orders/",
"fields": {"all_but": ["notes"]},
"format": {"html": {"get": false, "with_click": true}}
}
}
}
]
}
Form fields
A field the reader types into A box the reader ticks A list the reader picks from Several buttons, one answer The place kept for a signature
Where to go next
Every JSON key of a request, in one page The other twenty-two things you can draw