summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/pdf/pdf-object.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/pdf/pdf-object.c b/source/pdf/pdf-object.c
index 0ee399c5..b8147970 100644
--- a/source/pdf/pdf-object.c
+++ b/source/pdf/pdf-object.c
@@ -1737,6 +1737,29 @@ pdf_fprint_obj(FILE *fp, pdf_obj *obj, int tight)
return n;
}
+int pdf_output_obj(fz_output *out, pdf_obj *obj)
+{
+ char buf[1024];
+ char *ptr;
+ int n;
+ int tight = 1;
+
+ n = pdf_sprint_obj(NULL, 0, obj, tight);
+ if ((n + 1) < sizeof buf)
+ {
+ pdf_sprint_obj(buf, sizeof buf, obj, tight);
+ fz_printf(out, "%s\n", buf);
+ }
+ else
+ {
+ ptr = fz_malloc(obj->doc->ctx, n + 1);
+ pdf_sprint_obj(ptr, n + 1, obj, tight);
+ fz_printf(out, "%s\n", ptr);
+ fz_free(obj->doc->ctx, ptr);
+ }
+ return n;
+}
+
#ifndef NDEBUG
void
pdf_print_obj(pdf_obj *obj)