summaryrefslogtreecommitdiff
path: root/pdf/pdf_object.c
diff options
context:
space:
mode:
Diffstat (limited to 'pdf/pdf_object.c')
-rw-r--r--pdf/pdf_object.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/pdf/pdf_object.c b/pdf/pdf_object.c
index a2d9d37b..c3092afe 100644
--- a/pdf/pdf_object.c
+++ b/pdf/pdf_object.c
@@ -544,6 +544,25 @@ pdf_array_push(pdf_obj *obj, pdf_obj *item)
}
void
+pdf_array_push_drop(pdf_obj *obj, pdf_obj *item)
+{
+ fz_context *ctx = obj->ctx;
+
+ fz_try(ctx)
+ {
+ pdf_array_push(obj, item);
+ }
+ fz_always(ctx)
+ {
+ pdf_drop_obj(item);
+ }
+ fz_catch(ctx)
+ {
+ fz_rethrow(ctx);
+ }
+}
+
+void
pdf_array_insert(pdf_obj *obj, pdf_obj *item)
{
RESOLVE(obj);
@@ -1191,6 +1210,30 @@ pdf_drop_obj(pdf_obj *obj)
fz_free(obj->ctx, obj);
}
+pdf_obj *pdf_new_obj_from_str(fz_context *ctx, const char *src)
+{
+ pdf_obj *result;
+ pdf_lexbuf lexbuf;
+ fz_stream *stream = fz_open_memory(ctx, (unsigned char *)src, strlen(src));
+
+ pdf_lexbuf_init(ctx, &lexbuf, PDF_LEXBUF_SMALL);
+ fz_try(ctx)
+ {
+ result = pdf_parse_stm_obj(NULL, stream, &lexbuf);
+ }
+ fz_always(ctx)
+ {
+ pdf_lexbuf_fin(&lexbuf);
+ fz_close(stream);
+ }
+ fz_catch(ctx)
+ {
+ return NULL;
+ }
+
+ return result;
+}
+
/* Pretty printing objects */
struct fmt