summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/pdf/pdf-device.c5
-rw-r--r--source/pdf/pdf-xref.c1
2 files changed, 5 insertions, 1 deletions
diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c
index 3b974efe..2324dbd7 100644
--- a/source/pdf/pdf-device.c
+++ b/source/pdf/pdf-device.c
@@ -1127,6 +1127,11 @@ fz_device *pdf_new_pdf_device(fz_context *ctx, pdf_document *doc, const fz_matri
if (topctm != &fz_identity)
fz_buffer_printf(ctx, buf, "%M cm\n", topctm);
+
+ /* Initialise the resource tables if we have not done so
+ * already. */
+ if (doc->resources == NULL)
+ pdf_init_resource_tables(ctx, doc);
}
fz_catch(ctx)
{
diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c
index 01b72d04..576c315d 100644
--- a/source/pdf/pdf-xref.c
+++ b/source/pdf/pdf-xref.c
@@ -2770,7 +2770,6 @@ pdf_document *pdf_create_document(fz_context *ctx)
doc->num_incremental_sections = 0;
doc->xref_base = 0;
doc->disallow_new_increments = 0;
- pdf_init_resource_tables(ctx, doc);
pdf_get_populating_xref_entry(ctx, doc, 0);
trailer = pdf_new_dict(ctx, doc, 2);
pdf_dict_put_drop(ctx, trailer, PDF_NAME_Size, pdf_new_int(ctx, doc, 3));