Skip to content

JosueMerlos/ruby-fillform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ruby-fill-form: Fill Text and Images through Acroform Fields

Install

$ gem install ruby-fillform

Usage

Create a PDF form with LibreOffice or something else. I have only tested this with LibreOffice. Currently only text fields, check box and buttons are supported.

require 'ruby-fillform'

data = {}
data[:page_1] = {}
data[:page_1][:name] = { value: 'Josue Merlos' }
data[:page_1][:address] = { value: 'My Address' }

# Page number optional, substitute lastname var in all pages, thanks to hoverlover
data[:lastname] = { value: 'Merlos' }

# Create a PDF file with predefined data Fields
Prawn::Document.generate 'output.pdf', template: 'template.pdf'  do |pdf|
  pdf.fill_form_with(data)
end

Take a look in examples repo

https://github.com/JosueMerlos/ruby-fillform-example.git

#And on a per-form basis

See the :options param below

require 'ruby-fill-form'

data = {}
data[:page_1] = {}
data[:page_1][:name] = { value: 'Josue Merlos', options: {x_offset: 2, y_offset: -40} }
data[:page_1][:address] = { value: 'My Address' }

# Create a PDF file with predefined data Fields
Prawn::Document.generate 'output.pdf', template: 'template.pdf'  do |pdf|
  pdf.fill_form_with(data)
end

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages