Skip to content
Browse files

template.pdf fix in examples and requires active_support

  • Loading branch information...
1 parent 8179379 commit c9b6c8bc9a6321a8e429ce93f0cd29e77555c9ae Maurice Hadamczyk committed Jan 13, 2013
Showing with 13 additions and 9 deletions.
  1. +5 −3 README.md
  2. BIN data/output.pdf
  3. BIN data/template.pdf
  4. +6 −5 examples/main.rb
  5. +2 −1 prawn-fillform.gemspec
View
8 README.md
@@ -17,9 +17,11 @@ require 'prawn-fillform'
data = {}
data[:page_1] = {}
data[:page_1][:firstname] = { :value => "Max" }
-data[:page_1][:lastname] = { :value => "Mustermann" }
data[:page_1][:photo] = { :value => "test.jpg" }
+# Page number optional, substitute lastname var in all pages, thanks to hoverlover
+data[:lastname] = { :value => "Mustermann" }
+
# Create a PDF file with predefined data Fields
Prawn::Document.generate "output.pdf", :template => "template.pdf" do |pdf|
pdf.fill_form_with(data)
@@ -30,7 +32,7 @@ Take a look in `examples` folder
## Thanks to netinlet for fix field placement bug
-I was having issue with the form field placement (see https://github.com/moessimple/prawn-fillform/issues/1)
+I was having issue with the form field placement (see https://github.com/moessimple/prawn-fillform/issues/1)
Scribus and Adobe Acrobat don't open pdf's in the same way so the formatting comes out differently. Much like
opening a Word document in OpenOffice can some render with funny formatting.
@@ -44,7 +46,7 @@ Prawn::Document.use_adobe_xy_offsets! # Your mileage may vary! Defaults to x_off
Prawn::Document.fillform_x_offset
-Prawn::Document.fillform_y_offset
+Prawn::Document.fillform_y_offset
```
#And on a per-form basis
View
BIN data/output.pdf
Binary file not shown.
View
BIN data/template.pdf
Binary file not shown.
View
11 examples/main.rb
@@ -1,17 +1,18 @@
+#!/usr/bin/env ruby
# -*- encoding : utf-8 -*-
-require 'rubygems'
-$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')
+$LOAD_PATH << File.expand_path('../../lib/', __FILE__)
require 'prawn'
-require 'prawn/fillform'
-
+require 'active_support/all'
+require 'prawn-fillform'
data = {}
data[:page_1] = {}
data[:page_1][:firstname] = { :value => "Max" }
-data[:page_1][:lastname] = { :value => "Mustermann" }
data[:page_1][:photo] = { :value => "../data/test.jpg" }
+# Page number optional, substitute lastname var in all pages
+data[:lastname] = { :value => "Mustermann" }
Prawn::Document.generate "../data/output.pdf", :template => "../data/template.pdf" do |pdf|
View
3 prawn-fillform.gemspec
@@ -16,8 +16,9 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
-
+
s.add_dependency "prawn"
+ s.add_dependency "active_support/all"
# specify any dependencies here; for example:
# s.add_development_dependency "rspec"

0 comments on commit c9b6c8b

Please sign in to comment.
Something went wrong with that request. Please try again.