Package: pdftk
Version: 1.41-3
Followup-For: Bug #421343

I'm been pretty frustrated by this bug recently, so I was happy to discover  
that 
a couple script I wrote a while ago allow working around it. 

Basically I use 'pdftk foo.pdf dump_data_fields', and then use perl
module PDF::FDF::Simple to generate the fdf.

I'll try to attach the scripts, but failing that, look at


     http://www.cs.unb.ca/~bremner/blog/posts/filling_in_forms_with_pdftk/

-- System Information:
Debian Release: 5.0
  APT prefers testing
  APT policy: (900, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages pdftk depends on:
ii  libc6                         2.7-16     GNU C Library: Shared libraries
ii  libgcc1                       1:4.3.2-1  GCC support library
ii  libgcj8-1                     4.2.4-4    Java runtime library for use with 
ii  libstdc++6                    4.3.2-1    The GNU Standard C++ Library v3

pdftk recommends no packages.

Versions of packages pdftk suggests:
ii  poppler-utils [xpdf-utils]    0.8.7-1    PDF utilitites (based on libpopple

-- no debconf information
#!/usr/bin/env perl 

my ($LOOKING,$INSTATE)=(0,1);

my $state=$LOOKING;

while(<>){


  if (m/^FieldName:\s+(.*)$/){
    push(@names,$1);
    $curname=$1;
  }
  if (m/^FieldNameAlt:\s+(.*)$/){
      $comment{$curname}=$1;
  }


}

print '$fields={',"\n";
foreach $name (@names){
    if (defined($comment{$name})){
        print "\n# $comment{$name}\n";
    }
    printf "'%s%s'=>q{},\n",$name
}
print "\n};\n";
#!/usr/bin/env perl

use strict;
use PDF::FDF::Simple;

use Getopt::Std;

our $opt_o;

getopts("o:");



my $outfile=$opt_o || "-";


my %content=();
our $fields;

foreach my $file (@ARGV){
  open(IN,"$file") || die ("could not open $file");
  undef($/);
  my $in=<IN>;
  eval($in);
  die "reading input failed: $@" if $@;

  %content=(%content, %$fields);
}


my $f=new PDF::FDF::Simple({
                            filename => $outfile,
                            content => \%content });

$f->save;

Reply via email to