Unable to open file using pdftk

This is in relation to this thread:

(I was asked to create a new one as it was 6 months old)

I am using the following Ruby code but unable to open the pdf file.

require ‘rubygems’
require ‘pdf/toolkit’

class AbcController < ApplicationController
def get_teachings
my_pdf = PDF::Toolkit.open("/home/abc/mozilla.pdf")
text = my_pdf.to_text.read
puts text

The file exists but I am getting this error

PDF::Toolkit::ExecutionError in SaiController#get_teachings

Error invoking PDFTK

RAILS_ROOT: script/…/config/…
Application Trace | Framework Trace | Full Trace

read_data' /var/lib/gems/1.8/gems/pdf-toolkit-0.5.0/lib/pdf/toolkit.rb:279:inreload’
open' app/controllers/sai_controller.rb:9:inget_teachings’


Parameters: None

Show session dump
Headers: {“Cache-Control”=>“no-cache”, “cookie”=>[]}

I am running this on a Linux Ubuntu 64 bit.

I need a way to parse a pdf file’s contents and search for specific

I am not sure how to check for the file’s security settings as mentioned
in the previous post.

Any help would be appreciated.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs