summaryrefslogtreecommitdiff
path: root/source/tools/pdfmerge.c
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2017-06-03 21:27:33 -0700
committerRobin Watts <Robin.Watts@artifex.com>2017-06-03 21:27:33 -0700
commit7f0a9b9f4448f7f2e87313e9e147b631b687e81b (patch)
tree5259a54b29e55d19fe65d75ac35cbb56022e591c /source/tools/pdfmerge.c
parent876f1fe8aaa9b110b3211fedbe5decbd67cf8c45 (diff)
downloadmupdf-7f0a9b9f4448f7f2e87313e9e147b631b687e81b.tar.xz
Tweak pdf_graft_map API.
Passing a pdf_document to pdf_graft_object to specify the source document is redundant, as if we need to know the document, it will be pickled into the object we are copying. Similarly, repeatedly having to pass the destination document seems silly when we can just pickle it into the map too (and this removes the possibility of people using a different destination document part way through). This leaves to simplifying the pdf_graft_object call, at the expense of splitting it into 2 calls - one with a map, and one without. Also, we can delay the creation of the mapping table until we are first asked to copy an object that requires deep copying. This avoids us ever having to manually pass in the source document. This has knock-on effects in the java and javascript classes, but with the advantage of being clearer in the end (IMHO). Conflicts: include/mupdf/pdf/document.h
Diffstat (limited to 'source/tools/pdfmerge.c')
-rw-r--r--source/tools/pdfmerge.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/tools/pdfmerge.c b/source/tools/pdfmerge.c
index 7e38f0e1..14551ecf 100644
--- a/source/tools/pdfmerge.c
+++ b/source/tools/pdfmerge.c
@@ -56,7 +56,7 @@ static void page_merge(int page_from, int page_to, pdf_graft_map *graft_map)
{
obj = pdf_dict_get(ctx, page_ref, copy_list[i]);
if (obj != NULL)
- pdf_dict_put_drop(ctx, page_dict, copy_list[i], pdf_graft_object(ctx, doc_des, doc_src, obj, graft_map));
+ pdf_dict_put_drop(ctx, page_dict, copy_list[i], pdf_graft_mapped_object(ctx, graft_map, obj));
}
/* Add the page object to the destination document. */
@@ -81,7 +81,7 @@ static void merge_range(const char *range)
pdf_graft_map *graft_map;
count = pdf_count_pages(ctx, doc_src);
- graft_map = pdf_new_graft_map(ctx, doc_src);
+ graft_map = pdf_new_graft_map(ctx, doc_des);
fz_try(ctx)
{