- What if an input page specifies /Rotate?
- Better error messages from instantiation
- "-f" switch
-- nup(crop): take max of all bboxes first?
| # Position bbox on a new paper
| paper("a4")
| n=
| paper...
-# Set either:
-# - paper size + margins
-# - scale + margins
-nup(hnum, vnum)
- by=rows/cols # Filling order (default: rows)
- by=tile # Tile with copies of a single page
- paper / w / h # Specify paper size, default=copy from 1st image
- + fit options (*margin, pos)
- tpos=... # Position of images inside their tiles (default: tl)
- crop # Crop to image
- rotate=1 # Override rotation decision
- scale=1 # Override scaling factor
- hspace / vspace / space # Distance between tiles
+| # Set either:
+| # - paper size + margins
+| # - scale + margins
+| nup(hnum, vnum)
+| by=rows/cols # Filling order (default: rows)
+| by=tile # Tile with copies of a single page
+| paper / w / h # Specify paper size, default=copy from 1st image
+| + fit options (*margin, pos)
+| tpos=... # Position of images inside their tiles (default: tl)
+| crop # Crop to image
+| mixed # Allow images of different sizes
+| rotate=1 # Override rotation decision
+| scale=1 # Override scaling factor
+| hspace / vspace / space # Distance between tiles
+ cropmarks?
# Send pages to multiple pipes and merge their results
BY_TILE,
} fill_by;
bool crop;
+ bool mixed;
int rotate;
double scale;
paper_spec paper;
void try_config(nup_state &st);
nup_state best;
bool found_solution;
+ BBox common_page_box;
public:
nup_cmd(cmd *c) : paper(c), marg(c, "margin", "margin"), pos(c), tpos(c->arg("tpos")->as_string("tl"))
die("Parameter \"by\" must be rows/cols/tile");
crop = c->arg("crop")->as_int(0);
+ mixed = c->arg("mixed")->as_int(0);
rotate = c->arg("rotate")->as_int(-1);
scale = c->arg("scale")->as_double(0);
vector<page *> nup_cmd::process(vector<page *> &pages)
{
vector<page *> out;
- int i = 0;
+ // Unless mixed is given, find the common page size
+ if (!mixed)
+ {
+ for (int i=0; i < (int) pages.size(); i++)
+ {
+ page *p = pages[i];
+ BBox pb = crop ? p->image_box : BBox(p->width, p->height);
+ if (!i)
+ common_page_box = pb;
+ else
+ common_page_box.join(pb);
+ }
+ debug("NUP: Common page box [%.3f %.3f]-[%.3f %.3f]",
+ common_page_box.x_min, common_page_box.y_min, common_page_box.x_max, common_page_box.y_max);
+ }
+
+ // Process one tile set after another
+ int i = 0;
while (i < (int) pages.size())
{
vector<page *> in;
st.tile_w = st.tile_h = 0;
for (int i=0; i<num_tiles; i++)
{
- if (crop)
+ if (!mixed)
+ page_boxes[i] = common_page_box;
+ else if (crop)
page_boxes[i] = in[i]->image_box;
else
page_boxes[i] = BBox(in[i]->width, in[i]->height);
{ "m", AT_INT | AT_POSITIONAL },
{ "by", AT_STRING },
{ "crop", AT_SWITCH },
+ { "mixed", AT_SWITCH },
{ "rotate", AT_SWITCH },
{ "scale", AT_DOUBLE },
PAPER_ARGS,