Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push changes to upstream #4

Open
dsisnero opened this issue Jan 30, 2014 · 0 comments
Open

Push changes to upstream #4

dsisnero opened this issue Jan 30, 2014 · 0 comments

Comments

@dsisnero
Copy link

Can you give an example of a pdf or output of a pdftk dump_data_fields that the get_fields method in pdf-forms doesn't work. If I have this I can push this change to pdf-forms

# Return a hash of all fields in a given PDF
  def get_fields(url)
    #note: we're talking to PDFTK directly here
    # the native @pdftk.get_field_names doesn't seem to work on many government PDFs
    fields = @pdftk.call_pdftk( open( URI.escape( url ) ).path, 'dump_data_fields' )
    fields = fields.split("---")
    @output = []
    fields.each do |field|
      @hash = {}
      field.split("\n").each() do |line|
          next if line == ""
          key, value = line.split(": ")
          @hash[key] = value
      end
      next if @hash.empty?
      @output.push @hash
    end
    @output
  end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant