| mark=cross # Crosses in the corners
| mark=out # Out-pointing half-crosses in the corners (default)
| mark=in # In-pointing half-crosses
+| mark=bg # Colored background
| pen=1pt # Line width
| len=5mm # Cross arm length
| offset=5mm # Distance from border
MARK_CROSS,
MARK_OUT,
MARK_IN,
+ MARK_BG,
} type;
double pen_width;
double arm_length;
type = MARK_IN;
else if (t == "out")
type = MARK_OUT;
+ else if (t == "bg")
+ type = MARK_BG;
else
die("Invalid cropmark type %s", t.c_str());
offset = c->arg(prefix + "offset")->as_double(0);
egstate = QPDFObjectHandle::newNull();
}
+ bool is_bg() { return (type == MARK_BG); }
string pdf_stream(out_context *out, BBox &box, pdf_matrix &xform);
};
return "";
string s = "q ";
- s += color.to_string() + " RG ";
+ s += color.to_string() + (type == MARK_BG ? " rg " : " RG ");
s += xform.to_string() + " cm ";
if (egstate.isNull())
s += crop_cross(b.x_max, b.y_max, 0b0110);
s += crop_cross(b.x_min, b.y_max, 0b1010);
break;
+ case MARK_BG:
+ s += b.to_rect() + " re f ";
+ break;
}
s += "Q ";
{
for (int i=0; i < (int) orig_pages.size(); i++)
{
+ if (cmarks->is_bg())
+ out->contents += cmarks->pdf_stream(out, tile_boxes[i], parent_xform);
orig_pages[i]->render(out, xforms[i] * parent_xform);
- out->contents += cmarks->pdf_stream(out, tile_boxes[i], parent_xform);
+ if (!cmarks->is_bg())
+ out->contents += cmarks->pdf_stream(out, tile_boxes[i], parent_xform);
}
}