Hack 26 Put Crop Marks on a PageCommercial print shops usually require crop marks for custom-sized print pieces. This hack shows you how to include these important guides in a Word document. With its improved graphics and typography features, many individuals and small businesses rely on Word as a standalone desktop publishing program, especially as the price of full-featured programs such as InDesign remains high. Word does a fair job of handling layout tasks, but it still operates primarily as a word processor. It also lacks a few features essential for preparing printer-ready documents, such as the ability to insert crop marks. Printers (the trade, not the device) use crop marks when trimming paper to a particular size. Figure 3-50 shows a document with crop marks. These are most often used when the final printed piece will have smaller dimensions than a standard paper size, such as letter. It's much easier and cheaper to print a document using a standard paper size and trim it afterward than to print directly on paper that's unusually sized. Figure 3-50. A PDF of a document that includes crop marksTo create crop marks in a Word document, you can use the seldom-used PRINT field, discussed in [Hack #24] . 3.14.1 The Field Code
To see how a PRINT field can put crop marks on a page, open or create a single-page document. Next, put your cursor anywhere on the page and press Ctrl-F9 to insert an empty field at the insertion point. With your cursor still between the field braces, type the following: PRINT \p page " % Crop Marks .5 setlinewidth % bottom left 72 88 moveto 72 52 lineto 70 90 moveto 34 90 lineto % top left 70 720 moveto 34 720 lineto 72 722 moveto 72 758 lineto % top right 522 722 moveto 522 758 lineto 524 720 moveto 560 720 lineto % bottom right 522 88 moveto 522 52 lineto 524 90 moveto 560 90 lineto stroke " The PostScript instructions are divided into four main parts, one for each of the four corners of the document where crop marks will be inserted. Each moveto, lineto pair corresponds to one of the eight lines needed for a full set of crop marks (two perpendicular lines in each corner of the document). After you've created the PRINT field, print your document to file [Hack #23] to save it as a PostScript file. If you have a PostScript printer, when you print the document, it will have crop marks like the ones shown in Figure 3-50.
These crop marks correspond to a 1-inch top and bottom margin and a 1.25-inch left and right margin. To accommodate different margins, adjust the PostScript instructions accordingly.
3.14.2 Hacking the Hack
The PostScript code shown in the previous section works if you're working with Word's default margins, but if you want crop marks on a page with different margins, you need to work out the new coordinates. As much fun as a flashback to high-school geometry might be, it's better to work out the details once and then use a macro to adjust the coordinates for different margins. The following code creates a PRINT field with the correct coordinates based on a document's margins. The field is placed in the header of the section where the cursor is currently located. In most cases, that puts crop marks on every page of the document, though if you've explicitly defined multiple sections with different headers, you may need to adjust the macro to get the desired results. Place these five procedures in the template of your choice [Hack #50]
and run the main PlaceCropmarks procedure from the
Tools Sub PlaceCropmarks( ) Dim sngLeft As Single Dim sngRight As Single Dim sngTop As Single Dim sngBottom As Single Dim sPrintField As String Dim rng As Range With ActiveDocument.PageSetup sngLeft = .LeftMargin sngRight = .RightMargin sngTop = .TopMargin sngBottom = .BottomMargin End With ' Include initial field switches and PostScript instructions sPrintField = " \p page " & Chr$(34) & " .5 setlinewidth " ' Get correct coordinates using the four functions sPrintField = sPrintField & BottomLeft(sngLeft, sngBottom) sPrintField = sPrintField & TopLeft(sngLeft, sngTop) sPrintField = sPrintField & TopRight(sngRight, sngTop) sPrintField = sPrintField & BottomRight(sngRight, sngBottom) ' Add final PostScript instruction and close the field instruction sPrintField = sPrintField & "stroke" & Chr$(34) Set rng = Selection.Sections.First.Headers(wdHeaderFooterPrimary).Range rng.Collapse wdCollapseStart rng.Fields.Add Range:=rng, _ Type:=wdFieldPrint, _ Text:=sPrintField, _ PreserveFormatting:=False End Sub Function BottomLeft(sngLeft As Single, sngBottom As Single) As String Dim sReturn As String sReturn = sngLeft & " " & sngBottom - 2 & " moveto " sReturn = sReturn & sngLeft & " " & (sngBottom - 2) - 36 & " lineto " sReturn = sReturn & sngLeft - 2 & " " & sngBottom & " moveto " sReturn = sReturn & (sngLeft - 2) - 36 & " " & sngBottom & " lineto " BottomLeft = sReturn End Function Function TopLeft(sngLeft As Single, sngTop As Single) As String Dim sReturn As String sReturn = sngLeft & " " & (792 - sngTop) + 2 & " moveto " sReturn = sReturn & sngLeft & " " & (792 - (sngTop + 2)) + 36 & " lineto " sReturn = sReturn & sngLeft - 2 & " " & 792 - sngTop & " moveto " sReturn = sReturn & (sngLeft - 2) - 36 & " " & 792 - sngTop & " lineto " TopLeft = sReturn End Function Function TopRight(sngRight As Single, sngTop As Single) As String Dim sReturn As String sReturn = 612 - sngRight & " " & (792 - sngTop) + 2 & " moveto " sReturn = sReturn & 612 - sngRight & " " & (792 - (sngTop + 2)) + 36 & " lineto " sReturn = sReturn & (612 - sngRight) + 2 & " " & 792 - sngTop & " moveto " sReturn = sReturn & ((612 - sngRight) + 2) + 36 & " " & 792 - sngTop & " lineto " TopRight = sReturn End Function Function BottomRight(sngRight As Single, sngBottom As Single) As String Dim sReturn As String sReturn = 612 - sngRight & " " & sngBottom - 2 & " moveto " sReturn = sReturn & 612 - sngRight & " " & (sngBottom - 2) - 36 & " lineto " sReturn = sReturn & (612 - sngRight) + 2 & " " & sngBottom & " moveto " sReturn = sReturn & ((612 - sngRight) + 2) + 36 & " " & sngBottom & " lineto " BottomRight = sReturn End Function PRINT fields aren't visible in a document unless you've chosen to view field codes. To quickly see all the field codes in a document, press Alt-F9. Dan Mueller and Andrew Savikas |