tcocca / active_pdftk

ruby wrapper for the pdftk command line utility for working with editable pdf files
MIT License
46 stars 37 forks source link

preferences for Class Fdf & Xfdf #8

Closed elmatou closed 13 years ago

elmatou commented 13 years ago

Fdf & Xfdf class should behave in the same way, with the same methods

....
    #should be to_s, because it already is an xfdf object.
    def to_xfdf
....
    #should be to_s, because it already is an fdf object.
    def to_fdf
....
tcocca commented 13 years ago

I agree here, the classes should have the same "api", to_s seems to be better than anything I can think of.

Also, on the Fdf.new we support a second hash of 'options' but I don't see how that could ever be called right now. We only instantiate a new Fdf object in the #fill_form method on the Wrapper class and we aren't passing any of the additional stuff, not sure what the best way to support that is. I don't really like passing 2 hashes to the new method either ...

Not to familiar w/ FDF so I'm even sure what the 'file', 'ufile', 'id' stuff is anyway.

Thoughts? ~ Tom

elmatou commented 13 years ago

Done by commit: 02e2aa3d11fb01589149967787b01a3ee5c62dc1

tcocca commented 13 years ago

Feelings on the issue of the 'options' hash for the FDF? See the initialize method on that class. Not sure what to do here? Maybe we just leave it for now ...

elmatou commented 13 years ago

It is implemented in the header, but what does it mean ? the Perl library doesn't give any intel ! but should be read : http://search.cpan.org/~schwigon/PDF-FDF-Simple-0.21/lib/PDF/FDF/Simple.pod#attribute_file

The wiki articles on FDF is not very informative also, and FDF is described in the ISO PDF description ISO 32000-1:2008 (CHF 380,00 !!!).

Best thing, is to keep these attributes avaliable, until more infos. I'm comfortable with the idea of the second hash. or we could ask for a single hash and extract the attributes.

    def initialize(options = {})
      @data = options.delete_if {|k, v| [:file, :ufile, :id].include? k }
      @options = options.delete_if {|k, v| !k.any? [:file, :ufile, :id].include? k }
    end

Anyway options have also a getter, is to much ?!

vote for a single hash with extraction, and remove the getter.

tcocca commented 13 years ago

I think we should actually figure out what that stuff is for, because if we need it for something we'll need to add it to the #fill_form method where the Fdf gets generated. I'll do some research on it.

tcocca commented 13 years ago

See these PDF reference starting on page 671 for the FDF spec.

http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf

Looks like all those things are optional.

(Whoops added this comment to the wrong ticket before)

tcocca commented 13 years ago

Closing due to these options all being optional