Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
airblade committed Nov 2, 2011
0 parents commit 0a43a55
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Gemfile
@@ -0,0 +1,3 @@
source :rubygems

gem 'prawn', '1.0.0.rc1'
16 changes: 16 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,16 @@
GEM
remote: http://rubygems.org/
specs:
Ascii85 (1.0.1)
pdf-reader (0.10.1)
Ascii85 (~> 1.0.0)
prawn (1.0.0.rc1)
pdf-reader (>= 0.9.0)
ttfunk (~> 1.0.3)
ttfunk (1.0.3)

PLATFORMS
ruby

DEPENDENCIES
prawn (= 1.0.0.rc1)
16 changes: 16 additions & 0 deletions README.md
@@ -0,0 +1,16 @@
# Printing a PDF as-is

The PDF `margin-test.pdf` is A4 sized, with top and bottom margins of 15.3mm. You can see the Ruby code which generated it in `pdfer.rb`.

I need to print this PDF as-is on A4 paper. It has to be as-is because I'm printing sticky labels and they need to align.

When I view the PDF on screen (in Preview) at 100%, it displays correctly. I can measure the margins and verify they are correct.

But when I print it the box is not centred vertically: the top margin differs from the bottom margin. I have fiddled with the scale settings in the print dialog but to no avail.

It must be possible to print at 100%...can anyone enlighten me?

Thanks,

Andy Stewart
boss@airbladesoftware.com
Binary file added margin-test.pdf
Binary file not shown.
11 changes: 11 additions & 0 deletions pdfer.rb
@@ -0,0 +1,11 @@
require 'rubygems'
require 'prawn'
require 'prawn/measurement_extensions'

doc = Prawn::Document.new :page_size => 'A4',
:left_margin => 7.21.mm,
:right_margin => 7.21.mm,
:top_margin => 15.3.mm,
:bottom_margin => 15.3.mm
doc.stroke_bounds
doc.render_file 'margin-test.pdf'

0 comments on commit 0a43a55

Please sign in to comment.