Example on rpdf2text ?

Discussion in 'Ruby' started by coelho coelho, Jun 6, 2007.

  1. coelho coelho, Jun 6, 2007
    #1
    1. Advertising

  2. coelho coelho

    Hannes Wyss Guest

    On 6/6/07, coelho coelho <> wrote:
    > I am trying to use the rpdf2text library, does anyone have any example
    > on how to use properly? http://raa.ruby-lang.org/project/rpdf2txt/


    this is taken from bin/rpdf2txt (comments added for your benefit;)

    <snip>
    # create a parser-instance, with the pdf-content as its first argument.
    # The second argument is the encoding you want the resulting String to
    # have. Note: if you need utf8, I recommend the character-encoding
    # library by Nikolai Weibull

    parser = Rpdf2txt::parser.new(File.read(ARGV[0]), 'utf8')

    outstream = STDOUT
    if(ARGV.size == 2)
    outstream = File.open(ARGV[1], 'w')
    end

    # create a callback handler (If you roll your own, be sure to include
    # Rpdf2txt::DefaultHandler). outstream needs to respond to :<<

    handler = Rpdf2txt::ColumnHandler.new(outstream, padding)
    parser.extract_text(handler)
    </snip>

    There have recently been a couple of major improvements in how rpdf2txt
    positions characters. However, there's no official release for that yet.
    Since you're just starting out, I would recommend using a daily build
    from http://download.ywesee.com/rpdf2txt/rpdf2txt-daily.tar.bz2,
    or download rpdf2txt via git/cogito:

    cg-clone http://scm.ywesee.com/rpdf2txt

    Changelog: http://scm.ywesee.com/?p=rpdf2txt;a=summary

    hth,
    let me know if it works for you

    Hannes

    --
    pub 1024D/60312B5F 2003-10-09 Hannes Wyss <>
    Key fingerprint = 82D1 90C7 3F3D 93DC F715 4F8B 987A 628E 6031 2B5F
    www.ywesee.com > intellectual capital connected > www.oddb.org
     
    Hannes Wyss, Jun 6, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bright
    Replies:
    1
    Views:
    545
  2. Timo Dammes
    Replies:
    2
    Views:
    6,523
    Elliot Schei
    Jun 11, 2004
  3. bob

    Shift register example?

    bob, Feb 18, 2005, in forum: VHDL
    Replies:
    1
    Views:
    3,254
    Ralf Hildebrandt
    Feb 18, 2005
  4. Skybuck Flying

    Question about 2 bit counter example.

    Skybuck Flying, Aug 2, 2005, in forum: VHDL
    Replies:
    3
    Views:
    7,148
    Ralf Hildebrandt
    Aug 3, 2005
  5. Sam Roberts
    Replies:
    15
    Views:
    303
    Sam Roberts
    Feb 7, 2005
Loading...

Share This Page