Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Trung Lê committed Jul 10, 2012
0 parents commit 2e0f4bb
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions extract_fields.rb
@@ -0,0 +1,9 @@
require 'rubygems'
require 'nguyen'

pdftk = Nguyen::PdftkWrapper.new('/usr/local/bin/pdftk')

# Extract field names from file
field_names = pdftk.get_field_names('sample.pdf')

puts field_names.inspect
Binary file added fill_out_pdf_with_xfdf_ruby_meetup.pdf
Binary file not shown.
6 changes: 6 additions & 0 deletions populate_field_with_nguyen.rb
@@ -0,0 +1,6 @@
require 'rubygems'
require 'nguyen'

pdftk = Nguyen::PdftkWrapper.new('/usr/local/bin/pdftk')
xfdf = Nguyen::Xfdf.new(:given_name => 'Trung', :surname => 'Le')
pdftk.fill_form('sample.pdf', 'populated.pdf', xfdf)
1 change: 1 addition & 0 deletions populate_field_with_pdftk.sh
@@ -0,0 +1 @@
pdftk sample.pdf fill_form sample.xfdf output populated.pdf
Binary file added sample.pdf
Binary file not shown.
11 changes: 11 additions & 0 deletions sample.xfdf
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<fields>
<field name="given_name">
<value>Trung</value>
</field>
<field name="surname">
<value>Le</value>
</field>
</fields>
</xfdf>

0 comments on commit 2e0f4bb

Please sign in to comment.