pdf-toolkit
pdf-toolkit copied to clipboard
No such file or directory error
Hello, I have downloaded the latest version of pdf-toolkit gem for Ruby. When i try to use PDF::Toolkit.open command, i get the error 'No such file or directory - /dev/null'
I have tried giving the absolute path, relative paths, nothing works. Can someone please help? I have the code snippet as below.
Regards, Ramya
require 'rubygems' require 'pdf/toolkit'
begin filename = "Test.pdf" my_pdf = PDF::Toolkit.open(filename) text = my_pdf.to_text.read puts text rescue Exception => msg
display the system generated error message
puts msg end
Hello,
The only place where something could be wrong is here: https://github.com/blambeau/pdf-toolkit/blob/master/lib/pdf/toolkit/native.rb#L34
What is your environment? Can you send me the value of RUBY_PLATFORM?
Hello, Thanks for the speedy response. Here are the deatils: RUBY_PLATFORM : i386-mingw32. ruby 1.9.3p545 (2014-02-24) [i386-mingw32]
Please let me know if you need any more details.
Regards, Ramya
On Wed, Jul 30, 2014 at 6:42 AM, Bernard Lambeau [email protected] wrote:
Hello,
The only place where something could be wrong is here: https://github.com/blambeau/pdf-toolkit/blob/master/lib/pdf/toolkit/native.rb#L34
What is your environment? Can you send me the value of RUBY_PLATFORM?
— Reply to this email directly or view it on GitHub https://github.com/blambeau/pdf-toolkit/issues/4#issuecomment-50575778.
Ok. Could you try by replacing the line (lib/pdf/toolkit/native.rb:34)
STDERR.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null')
by
STDERR.reopen(RUBY_PLATFORM =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
If it works on your computer, I'll make the change in the repo, but I can't test it easily, having no windows machine.
Thanks Bernard. I have made that change to native.rb. There is no error during the open however, Now i get this error when trying to execute 'my_pdf.to_text.read' line
No such file or directory - "pdftotext" "C:\Downloads\PrivateCompanyPreview.pdf" "-"
This is the code I have:
require 'rubygems'
require 'pdf/toolkit'
begin
filename = "C:\Downloads\PrivateCompanyPreview.pdf"
my_pdf = PDF::Toolkit.open(filename)
text = my_pdf.to_text.read
puts text
rescue Exception => msg
display the system generated error message
puts msg
end
Clearly, the pdftk installation under windows is not the same as in linux.
pdftotext
is a commandline utility that should come bundled with the installation pdf toolkit.
ah i see. So, is there a workaround for this issue?
Regards, Ramya
On Wed, Jul 30, 2014 at 2:38 PM, Bernard Lambeau [email protected] wrote:
Clearly, the pdftk installation under windows is not the same as in linux.
pdftotext is a commandline utility that should come bundled with the installation pdf toolkit.
— Reply to this email directly or view it on GitHub https://github.com/blambeau/pdf-toolkit/issues/4#issuecomment-50614935.
Not that I know. You should check the documentation of pdf toolkit under windows.