Mako Printers' Marks
Mako Printers' Marks
Mako Printers' Marks adds printers' marks to a document, the short lines and targets outside the nominal dimensions of the page that guide the alignment of the color plates on the press and the post-press processes such as trimming.
To do this, the application must expand the media size to make room, add the marks to the page using an ink that will separate on to all the plates, and set the various page boxes that PDF employs to ensure imposition and other pre-press operations behave correctly.
Mako Printers' Marks v1.0.0.X
Usage: makoprintersmarks <source PDF or XPS file> <output.pdf>
makoprintersmarks <input.ext> <output.ext> [parameter=setting] [parameter=setting] ...
parameter=setting one or more settings, described below.
Parameters:
input.ext The name of the input file (pdf/xps/pxl/pcl).
output.ext target file to write the output to (pdf/xps/pxl/pcl)
If no output file is declared, <input>_marked.pdf is assumed
pw=<password> Password required to open the input (PDF) file
trim=yes|no Add trim marks. Default is yes
bleed=yes|no Add bleed marks. Default is no
bleedsize Specifies the bleed size in millimeters. Default is 3mm.
In all cases, the PDF page size is expanded to accommodate, if required.
reg=yes|no Add registration marks (targets). Default is no
colorbar=yes|no Add colorbars (gray and color). Default is no
pageinfo=yes|no Add page information. Default is no
weight=1|2|3 Specifies line weight where 1 = 0.125pts, 2 = 0.25 pts and 3 = 0.5pts. Default is 0.125pts
How it works
The process of adding printers' marks involves a number of processes:
- Expanding the page
- Setting page boxes
- Defining an ink that will print on every separation
- Drawing marks
- Drawing color bars
- Drawing targets
Expanding the page to accommodate the marks
To do this, the code first expands the dimensions of the page to twice the length of the trim marks plus the width of the bleed margin, using IDOMFixedPage::setWidth()
and setHeight()
. This leaves the page content at the top left, so it must be moved down and to the right to center it on the expanded page. A group (IDOMGroup)
created with an appropriate transform (FMatrix)
into which the content is moved (by using extractChild()
, which removes content from the fixed page (followed by an appendChild()
to add it to the group).
Setting page boxes
PDF has a hierarchy of page boxes that defines the size of the page. Originally PDF had just two: the MediaBox and the CropBox. Later, the TrimBox, BleedBox, and ArtBox were added to support print production.
- The MediaBox sets the size of the media; all other boxes can only be the same size or smaller.
- The CropBox defines the area of the page to be displayed or printed.
- The TrimBox defines the size of the final printed piece (that is, after physically trimming the paper).
- The BleedBox defines an area that is generally slightly larger than the TrimBox, that graphics such an image or a block of color may "bleed" into, to allow for a margin of error when trimming the page
- The ArtBox was originally designed to define an area of the page that is to be placed on the page in a desktop publishing application (for example, to facilitate placing an ad on to a page).
Besides setting these dimensions correctly to meet the needs of downstream processing, they are used in this application to correctly position the marks and targets that make up the set of printers' marks.
Using these methods of IDOMFixedPage
:
- The MediaBox is set implicitly by defining the page size with
setWidth()
andsetHeight().
- The TrimBox is set with
setTrimBox().
- The BleedBox is set with
setBleedBox().
- The ArtBox is set to the same size as the TrimBox with
setContentBox().
Defining an ink that will print on every separation
This requires making an ink (a color) that is defined in such a way as to appear on every plate when separations are created. For example, a print job PDF may use the process colors (cyan, magenta, yellow, black) and two spots, so a color has to be created with six colorants.
The method that does this is:
IDOMColorPtr MarkerColor(IJawsMakoPtr jawsMako, IDOMFixedPagePtr fixedPage)
The inks used on the page can be obtained with IRendererTransform::findInks(),
which returns a vector. The list is then processed to create a vector of colorants that can be used to create a DeviceN
color:
// Create the DeviceN space
const IDOMColorSpaceDeviceNPtr deviceN = IDOMColorSpaceDeviceN::create(jawsMako, colorants, alternate);
The final step is to create a color with the new colorspace that can be used to color page objects:
// Finally, create a color with every component set to 1.0 (all inks 100%)
CEDLVector<float> components(colorants.size());
for (uint32 i = 0; i < components.size(); i++)
{
components[i] = 1.0f;
}
return IDOMColor::createFromVect(jawsMako, deviceN, 1.0f, components);
Drawing marks
Mako has a structure, FPoint
, to store the XY position on a page, where (0,0) is located at the top-left corner of the page, and measured in Mako units (1/96th").
To draw lines on a page it is necessary to create a hierarchy of Mako objects:
- A line segment (
IDOMPolyLineSegment
) that is added to... - A figure (
IDOMPathFigure
) that is added to... - A geometry (
IDOMPathGeometry
) that is used to create... - A path node (
IDOMPathNode
) that is added to the page
The method DrawMark()
has this code to do this:
// Line segment
IDOMPolyLineSegmentPtr lineSegment = createInstance<IDOMPolyLineSegment>(jawsMako);
lineSegment->addPoint(to);
// Figure
IDOMPathFigurePtr pathFigure = createInstance<IDOMPathFigure>(jawsMako);
pathFigure->setStartPoint(from);
pathFigure->addSegment(lineSegment);
// Geometry
IDOMPathGeometryPtr pointsListGeometry = createInstance<IDOMPathGeometry>(jawsMako);
pointsListGeometry->addFigure(pathFigure);
// And now draw a path using the marker brush
IDOMPathNodePtr path = IDOMPathNode::createStroked(jawsMako, pointsListGeometry, solidBrush);
path->setStrokeThickness(strokeThickness);
fixedPage->appendChild(path);
A future version of Mako will have some convenience methods for creating simple markup of this type.
Drawing color bars
This involves drawing a series of small square boxes filled with a color. In a manner similar to drawing a line, a path node is created from path geometry. Fortunately there is a convenience method (create
) to do this from an FRect
, a struct that defines the X,Y
origin and size of a rectangle. So in code, a box is created thus:
FRect box = FRect(x, y, dX, dY);
IDOMPathNodePtr path =
IDOMPathNode::createStroked(jawsMako, IDOMPathGeometry::create(jawsMako, box), boxBorderBrush);
path->setStrokeThickness(1.5);
path->setFill(colors[i]);
fixedPage->appendChild(path);
Drawing targets
This could have been achieved using the same techniques already discussed, but instead the necessary DOM (Document Object Model) objects are copied from a PDF and moved into position using the same technique described in the readme for Mako Imposer.
Useful sample code
- Setting or changing page dimensions
- Setting page box dimensions accurately
- Create a color that will mark all separations
- Drawing straight lines