Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such file or directory error #4

Open
ramyakp opened this issue Jul 29, 2014 · 7 comments
Open

No such file or directory error #4

ramyakp opened this issue Jul 29, 2014 · 7 comments

Comments

@ramyakp
Copy link

ramyakp commented Jul 29, 2014

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

@ramyakp ramyakp changed the title No sucg file or directory error No such file or directory error Jul 29, 2014
@blambeau
Copy link
Owner

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?

@ramyakp
Copy link
Author

ramyakp commented Jul 30, 2014

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
#4 (comment).

@blambeau
Copy link
Owner

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.

@ramyakp
Copy link
Author

ramyakp commented Jul 30, 2014

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

@blambeau
Copy link
Owner

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.

@ramyakp
Copy link
Author

ramyakp commented Jul 30, 2014

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
#4 (comment).

@blambeau
Copy link
Owner

Not that I know. You should check the documentation of pdf toolkit under windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants