From: Martin Mares Date: Fri, 1 Jun 2018 22:36:58 +0000 (+0200) Subject: Fixed the margins command to match documentation X-Git-Tag: v1.1~2 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=38f253ae909bac7007078cc6df6f535561211cbc;p=paperjam.git Fixed the margins command to match documentation --- diff --git a/cmds.cc b/cmds.cc index 3fc1214..f16cd99 100644 --- a/cmds.cc +++ b/cmds.cc @@ -920,14 +920,10 @@ public: margins_cmd(cmd *c) : marg(c, "size", "") { } page *process_page(page *p) override { - pdf_matrix xf; - xf.shift(-p->image_box.x_min, -p->image_box.y_min); - xf.shift(marg.l, marg.b); - page *q = new xform_page(p, xf); - q->width = p->image_box.width() + marg.l + marg.r; - q->height = p->image_box.height() + marg.t + marg.b; - if (q->width < 0.001 || q->height < 0.001) - err("Margins must result in positive page dimensions"); + page *q = new xform_page(p, pdf_matrix()); + q->image_box = BBox(marg.l, marg.t, p->width - marg.r, p->height - marg.b); + if (q->image_box.width() < 0.001 || q->image_box.height() < 0.001) + err("Margins must result in positive image dimensions"); return q; } };