summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-form.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-09-18 11:47:22 +0200
committerRobin Watts <robin.watts@artifex.com>2018-09-19 17:13:45 +0100
commit92a5b99aac65e0cfbaade191483b485fa9918641 (patch)
tree6fea6fcb5f54f0678c210f15924816437fff5ab3 /source/pdf/pdf-form.c
parent6ff43c0f084b2ca5356ee6710b23fd751ce94749 (diff)
downloadmupdf-92a5b99aac65e0cfbaade191483b485fa9918641.tar.xz
Add accessor for field text label.
Diffstat (limited to 'source/pdf/pdf-form.c')
-rw-r--r--source/pdf/pdf-form.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/pdf/pdf-form.c b/source/pdf/pdf-form.c
index d5dad22b..a868bf75 100644
--- a/source/pdf/pdf-form.c
+++ b/source/pdf/pdf-form.c
@@ -922,6 +922,16 @@ char *pdf_field_name(fz_context *ctx, pdf_document *doc, pdf_obj *field)
return get_field_name(ctx, doc, field, 0);
}
+const char *pdf_field_label(fz_context *ctx, pdf_document *doc, pdf_obj *field)
+{
+ pdf_obj *label = pdf_dict_get_inheritable(ctx, field, PDF_NAME(TU));
+ if (!label)
+ label = pdf_dict_get_inheritable(ctx, field, PDF_NAME(T));
+ if (label)
+ return pdf_to_text_string(ctx, label);
+ return "Text Field";
+}
+
void pdf_field_set_display(fz_context *ctx, pdf_document *doc, pdf_obj *field, int d)
{
pdf_obj *kids = pdf_dict_get(ctx, field, PDF_NAME(Kids));