# Rpdf2txt

**URL:** <https://www.ruby-forum.com/t/rpdf2txt/122725>\
**Category:** Ruby\
**Created:** [December 11, 2007, 10:21am UTC](https://www.ruby-forum.com/t/rpdf2txt/122725 "2007-12-11T10:21:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![qwerty73](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/9d8465/32.png) [@qwerty73](https://www.ruby-forum.com/u/qwerty73)\
**Post date:** [December 11, 2007, 10:21am UTC](https://www.ruby-forum.com/t/rpdf2txt/122725/1 "2007-12-11T10:21:46Z")

</div>

Hi to all,  
i’m trying to make a pdf parser. This is my code and the script seems to  
work…

require ‘rpdf2txt/parser’  
require ‘rpdf2txt/default\_handler’

parser = Rpdf2txt::Parser.new(File.read(‘filename.pdf’))  
output = File.open(‘prova.txt’, ‘w’)  
handler = Rpdf2txt::SimpleHandler.new(output)  
parser.extract\_text(handler)

The problem is that the file ‘prova.txt’ created is empty. I’ve not  
found documentation about this library so i don’t know what i’m doing  
wrong.  
Can anybody help me??

thanks in advance

Andrea C.

---

<div class="post-metadata">

**Author:** ![qwerty73](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/9d8465/32.png) [@qwerty73](https://www.ruby-forum.com/u/qwerty73)\
**Post date:** [December 12, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/rpdf2txt/122725/2 "2007-12-12T20:35:16Z")

</div>

Ciao Andrea

On Dec 11, 2007 10:21 AM, Andrea C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> parser.extract\_text(handler)  
> That looks right - if you can you send me your PDF off-list I’ll have a  
> look.

cheers  
Hannes

---

<div class="post-metadata">

**Author:** ![qwerty73](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/9d8465/32.png) [@qwerty73](https://www.ruby-forum.com/u/qwerty73)\
**Post date:** [December 13, 2007, 9:32am UTC](https://www.ruby-forum.com/t/rpdf2txt/122725/3 "2007-12-13T09:32:59Z")

</div>

> > parser.extract\_text(handler)
> 
> That looks right - if you can you send me your PDF off-list I’ll have a look.
> 
> cheers  
> Hannes  
> Ciao Hannes,

i’ve send u an email with the PDF document that i’m using to make the  
tests, do you mean this???

cheers

Andrea

---

<div class="post-metadata">

**Author:** ![qwerty73](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/9d8465/32.png) [@qwerty73](https://www.ruby-forum.com/u/qwerty73)\
**Post date:** [December 13, 2007, 9:34am UTC](https://www.ruby-forum.com/t/rpdf2txt/122725/4 "2007-12-13T09:34:09Z")

</div>

> > parser.extract\_text(handler)
> 
> That looks right - if you can you send me your PDF off-list I’ll have a look.
> 
> cheers  
> Hannes  
> Ciao Hannes,

i’ve send u an email with the PDF document that i’m using to make the  
tests, do you mean this???

cheers

Andrea

---

<div class="post-metadata">

**Author:** ![qwerty73](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/9d8465/32.png) [@qwerty73](https://www.ruby-forum.com/u/qwerty73)\
**Post date:** [December 13, 2007, 10:16am UTC](https://www.ruby-forum.com/t/rpdf2txt/122725/5 "2007-12-13T10:16:20Z")

</div>

> > parser.extract\_text(handler)
> 
> That looks right - if you can you send me your PDF off-list I’ll have a look.
> 
> cheers  
> Hannes  
> Ciao Hannes,

i’ve send u an email with the PDF document that i’m using to make the  
tests, do you mean this???

cheers

Andrea

---

<div class="post-metadata">

**Author:** ![qwerty73](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/9d8465/32.png) [@qwerty73](https://www.ruby-forum.com/u/qwerty73)\
**Post date:** [December 13, 2007, 10:08am UTC](https://www.ruby-forum.com/t/rpdf2txt/122725/6 "2007-12-13T10:08:43Z")

</div>

> > parser.extract\_text(handler)
> 
> That looks right - if you can you send me your PDF off-list I’ll have a look.
> 
> cheers  
> Hannes  
> Ciao Hannes,

i’ve send u an email with the PDF document that i’m using to make the  
tests, do you mean this???

cheers

Andrea

---

<div class="post-metadata">

**Author:** ![qwerty73](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/9d8465/32.png) [@qwerty73](https://www.ruby-forum.com/u/qwerty73)\
**Post date:** [December 13, 2007, 10:22am UTC](https://www.ruby-forum.com/t/rpdf2txt/122725/7 "2007-12-13T10:22:47Z")

</div>

Good Morning!

On Dec 13, 2007 9:30 AM, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> i’ve send u an email with the PDF document that i’m using to make the  
> tests, do you mean this???

Interesting - this is the very first PDF-Document I’ve seen that uses  
ASCII85 Encoding.

A simple ASCII85 Decoder, anyone?

Andrea: you’ll have to give me some time on this one - I’ll get back  
to you with a patch…

Cheers  
Hannes
