Skip to content

Instantly share code, notes, and snippets.

@remear
Forked from amoeba/crop-marks.rb
Created August 24, 2009 16:09
Show Gist options
  • Save remear/173946 to your computer and use it in GitHub Desktop.
Save remear/173946 to your computer and use it in GitHub Desktop.
require 'prawn'
Prawn::Document.generate('crop-marks.pdf') do
spacing = 12
margin = 100
canvas do
# topleft corner
stroke_line [bounds.left + spacing, bounds.top - margin],
[bounds.left + margin - spacing, bounds.top - margin]
stroke_line [bounds.left + margin, bounds.top - spacing],
[bounds.left + margin, bounds.top - margin + spacing]
# topright corner
stroke_line [bounds.right - spacing, bounds.top - margin],
[bounds.right - margin + spacing, bounds.top - margin]
stroke_line [bounds.right - margin, bounds.top - spacing],
[bounds.right - margin, bounds.top - margin + spacing]
# bottomleft corner
stroke_line [bounds.left + spacing, bounds.bottom + margin],
[bounds.left + margin - spacing, bounds.bottom + margin]
stroke_line [bounds.left + margin, bounds.bottom + spacing],
[bounds.left + margin, bounds.bottom + margin - spacing]
# bottomright corner
stroke_line [bounds.right + spacing, bounds.bottom + margin],
[bounds.right - margin + spacing, bounds.bottom + margin]
stroke_line [bounds.right - margin, bounds.bottom + spacing],
[bounds.right - margin, bounds.bottom + margin - spacing]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment