From 38f253ae909bac7007078cc6df6f535561211cbc Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 2 Jun 2018 00:36:58 +0200 Subject: [PATCH] Fixed the margins command to match documentation --- cmds.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) 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; } }; -- 2.39.5