From 3fe81c6eadc24068e8bbb3d79ae38beea34d7d6f Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 1 Mar 2016 20:19:16 +0100 Subject: js: Add PDF document and object access. --- source/pdf/pdf-object.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'source/pdf') diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c index 406580b2..10a16c8a 100644 --- a/source/pdf/pdf-object.c +++ b/source/pdf/pdf-object.c @@ -388,6 +388,19 @@ pdf_document *pdf_get_indirect_document(fz_context *ctx, pdf_obj *obj) return REF(obj)->doc; } +pdf_document *pdf_get_bound_document(fz_context *ctx, pdf_obj *obj) +{ + if (obj < PDF_OBJ__LIMIT) + return NULL; + if (obj->kind == PDF_INDIRECT) + return REF(obj)->doc; + if (obj->kind == PDF_ARRAY) + return ARRAY(obj)->doc; + if (obj->kind == PDF_DICT) + return DICT(obj)->doc; + return NULL; +} + int pdf_objcmp_resolve(fz_context *ctx, pdf_obj *a, pdf_obj *b) { RESOLVE(a); -- cgit v1.2.3