diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2012-05-23 14:59:26 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-05-23 14:59:26 +0200 |
commit | d7d281dea2f9816730337d97d110c6ddc20ff5c0 (patch) | |
tree | e140c436af23778ce1ea060bd3f3f461d95883bd /apps/mupdfposter.c | |
parent | fc3dfd623ec30e912bed9615126e0656406a5b75 (diff) | |
download | mupdf-d7d281dea2f9816730337d97d110c6ddc20ff5c0.tar.xz |
Bring xref object and stream mutation functions back from the dead.
Needs more work to use the linked list of free xref slots.
Diffstat (limited to 'apps/mupdfposter.c')
-rw-r--r-- | apps/mupdfposter.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/mupdfposter.c b/apps/mupdfposter.c index 19198982..c7f61653 100644 --- a/apps/mupdfposter.c +++ b/apps/mupdfposter.c @@ -45,7 +45,7 @@ static void decimatepages(pdf_document *xref) pdf_dict_puts(root, "Type", pdf_dict_gets(oldroot, "Type")); pdf_dict_puts(root, "Pages", pdf_dict_gets(oldroot, "Pages")); - pdf_update_object(xref, pdf_to_num(oldroot), pdf_to_gen(oldroot), root); + pdf_update_object(xref, pdf_to_num(oldroot), root); pdf_drop_obj(root); @@ -79,10 +79,16 @@ static void decimatepages(pdf_document *xref) { for (x = 0; x < xf; x++) { - pdf_obj *newpageobj = pdf_copy_dict(ctx, xref->page_objs[page]); - pdf_obj *newpageref = pdf_new_ref(xref, newpageobj); - pdf_obj *newmediabox = pdf_new_array(ctx, 4); + pdf_obj *newpageobj, *newpageref, *newmediabox; fz_rect mb; + int num; + + newpageobj = pdf_copy_dict(ctx, xref->page_objs[page]); + num = pdf_create_object(xref); + pdf_update_object(xref, num, newpageobj); + newpageref = pdf_new_indirect(ctx, num, 0, xref); + + newmediabox = pdf_new_array(ctx, 4); mb.x0 = page_details->mediabox.x0 + (w/xf)*x; if (x == xf-1) @@ -170,7 +176,7 @@ int pdfposter_main(int argc, char **argv) /* Only retain the specified subset of the pages */ decimatepages(xref); - pdf_write(xref, outfile, &opts); + pdf_write_document(xref, outfile, &opts); pdf_close_document(xref); fz_free_context(ctx); |