How to create crop marks using Ibex
Using Ibex you can create crop marks on a page using a simple SVG image. The image is repeated in the four corners of the page using absolutely positioned block-containers.
This example shows how to create a document with crop marks on every page.
Approach
We want crop marks to be placed near the corners of each page, and to be placed on every page. We will use an SVG image for the crop mark itself, and use absolutely positioned block-containers to place the image in the correct locations. The block-containers are placed in the page header to that they are automatically repeated on every page. The crop mark image
The crop mark image is held in an external SVG file called crop.svg. The file contains the following SVG code for drawing a simple cross:
<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
<g transform="translate(18,18)">
<line x1="-20" x2="20" y1="0" y2="0" style="fill:black" width="10"/>
<line x1="0" x2="0" y1="-20" y2="20" style="fill:black" width="10"/>
</g>
</svg>
Placing the crop mark
The FO file crop-marks.fo defines a page with a header region and a body region. Within the page-sequence, a static-content element is used to place the crop marks. This has four absolutely positioned block-containers, one for each corner of the page. The static-content looks like this:
<static-content flow-name="xsl-region-before">
<block-container position="fixed" top="0.5cm" left="0.5cm" width="3cm" height="3cm">
<block font-size="0pt">
<external-graphic src="url(crop.svg)"/>
</block>
</block-container>
<block-container position="fixed" top="0.5cm" left="19.5cm" width="3cm" height="3cm">
<block font-size="0pt">
<external-graphic src="url(crop.svg)"/>
</block>
</block-container>
<block-container position="fixed" top="28cm" left="0.5cm" width="3cm" height="3cm">
<block font-size="0pt">
<external-graphic src="url(crop.svg)"/>
</block>
</block-container>
<block-container position="fixed" top="28cm" left="19.5cm" width="3cm" height="3cm">
<block font-size="0pt">
<external-graphic src="url(crop.svg)"/>
</block>
</block-container>
</static-content>
Note the use of font-size="0pt" on the blocks containing the crop image. This prevents leading from slightly altering the position of the image.
The resulting PDF file can be found at crop-marks.pdf