summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-object.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-04-26 17:01:54 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-04-27 14:15:15 +0200
commit617e280738a7dd91a6289f6e2e4e361785fb2281 (patch)
treef8cca05007266aae665a1cdcae72c69d9a3065f1 /source/pdf/pdf-object.c
parent229761e8b7e8685620cf4c038d848bccd563aa12 (diff)
downloadmupdf-617e280738a7dd91a6289f6e2e4e361785fb2281.tar.xz
Add pdf_dict_get_int, etc.
Diffstat (limited to 'source/pdf/pdf-object.c')
-rw-r--r--source/pdf/pdf-object.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c
index 837a8033..4360ea7c 100644
--- a/source/pdf/pdf-object.c
+++ b/source/pdf/pdf-object.c
@@ -2221,3 +2221,41 @@ pdf_obj *pdf_array_push_dict(fz_context *ctx, pdf_obj *array, int initial)
pdf_array_push_drop(ctx, array, obj);
return obj;
}
+
+int pdf_dict_get_bool(fz_context *ctx, pdf_obj *dict, pdf_obj *key)
+{
+ return pdf_to_bool(ctx, pdf_dict_get(ctx, dict, key));
+}
+
+int pdf_dict_get_int(fz_context *ctx, pdf_obj *dict, pdf_obj *key)
+{
+ return pdf_to_int(ctx, pdf_dict_get(ctx, dict, key));
+}
+
+float pdf_dict_get_real(fz_context *ctx, pdf_obj *dict, pdf_obj *key)
+{
+ return pdf_to_real(ctx, pdf_dict_get(ctx, dict, key));
+}
+
+const char *pdf_dict_get_string(fz_context *ctx, pdf_obj *dict, pdf_obj *key, size_t *sizep)
+{
+ pdf_obj *val = pdf_dict_get(ctx, dict, key);
+ if (sizep)
+ *sizep = pdf_to_str_len(ctx, val);
+ return pdf_to_str_buf(ctx, val);
+}
+
+int pdf_array_get_bool(fz_context *ctx, pdf_obj *array, int index)
+{
+ return pdf_to_bool(ctx, pdf_array_get(ctx, array, index));
+}
+
+int pdf_array_get_int(fz_context *ctx, pdf_obj *array, int index)
+{
+ return pdf_to_int(ctx, pdf_array_get(ctx, array, index));
+}
+
+float pdf_array_get_real(fz_context *ctx, pdf_obj *array, int index)
+{
+ return pdf_to_real(ctx, pdf_array_get(ctx, array, index));
+}