Giter Site home page Giter Site logo

Issues with Windows Server about wicked_pdf HOT 11 CLOSED

mileszs avatar mileszs commented on August 27, 2024
Issues with Windows Server

from wicked_pdf.

Comments (11)

mileszs avatar mileszs commented on August 27, 2024

I'm sorry; I have neither tried it on Windows, nor do I have access to Vista.

from wicked_pdf.

konung avatar konung commented on August 27, 2024

I have a virtual Windows XP, Windows Server 2003 64-bit & Windows 7 Ultimate 64-bit - all running wkhtmltopdf just - fine - but I would go to wkhtmltopdf google group to ask more info about your problem - you will probably get more help there.

from wicked_pdf.

23st4u avatar 23st4u commented on August 27, 2024

I just posted my solution to a similar problem here:
http://code.google.com/p/wkhtmltopdf/issues/detail?id=162#c5

It seems to be an issue related to some wicked_pdf code after all. Maybe the suggested adjustment can be made within the main code accordingly.

from wicked_pdf.

konung avatar konung commented on August 27, 2024

Actually I discovered an additional bug related to this. Standard Open3 gem doesn't implement fork(), and that error kept coming up. Fixed it by changing require from 'open3' to 'popen4' ( a wrapper from codeforpeople). Also as suggested above by adding "b" option in line 21 of wicked_pdf.rb. Hope that helps

from wicked_pdf.

Stueck avatar Stueck commented on August 27, 2024

fixed same problem with windows 7 64bit by installing:
gem install win32-open3
and changing the require 'open3' to require 'win32/open3' (wicked_pdf.rb in plugin-dir/lib)

I am developing on windows, but running the production server at linux. how to make this require-line for both plattform individual?

from wicked_pdf.

konung avatar konung commented on August 27, 2024

Stueck you can check against a global called RUBY_PLATFORM - windows system will spit out something like win32 or mingw32 - depending on how it was compiled .
Check out this little helper I wrote: http://github.com/konung/santas_little_helper/blob/master/lib/santas_little_helper.rb

from wicked_pdf.

Stueck avatar Stueck commented on August 27, 2024

Great, thank you very much.

from wicked_pdf.

luisfernandos avatar luisfernandos commented on August 27, 2024

Hi I am developing in windows, but my server is linux.
I did try generating a pdf with image for windows but without any lucky, however it is working fine for linux... (it doesn't matter if you are using relative path or full path)
I'd like to give my contribution to this plugin and to this thread.
I'm not quite sure how to do it, so I will just put it here, hopefull somebody can get this and add to the main branch.

First, Use konung and create a file in the lib directory, mine is platform.rb
Secondly, it is necessary to install the gem win32-open for windows
Thirdly, Change the file wicked_pdf, in the plugins lib directory
do the following:
a) Add the lines in the beging of the file, remember to remove require 'open3', it just works for linux ...
require 'platform'
if linux? || mac?
require 'open3'
else
require 'win32/open3'
end

b) add a new method for the class WickedPdf
def popen3(command_for_stdin_stdout,type, &block)
if linux? || mac?
Open3.popen3(command_for_stdin_stdout, &block)
else
Open3.popen3(command_for_stdin_stdout, type, &block)
end
end

c) Change the Open3.popen3 to use the new method created, so the pdf_to_string will be as:
def pdf_from_string(string, options=nil)
command_for_stdin_stdout = "#{@exe_path} #{options} --ignore-load-errors - - -q"
p "_"15 + command_for_stdin_stdout + ""_15 if RAILS_ENV == 'development'

popen3(command_for_stdin_stdout, 'b') do |stdin, stdout, stderr|
  stdin.write(string)
  stdin.close
  pdf = stdout.read
  raise "PDF could not be generated!\n#{stderr.read}" if pdf.length == 0
  pdf
end

end

from wicked_pdf.

ReggieBeans avatar ReggieBeans commented on August 27, 2024

If you've used the one-click installer to install ruby on windows, you may need to read this to get win32/open3 to work:

http://groups.google.com/group/ruby-talk-google/browse_thread/thread/b18e36aa7de46cfd?pli=1

from wicked_pdf.

soorajb avatar soorajb commented on August 27, 2024

Could you try https://github.com/soorajb/wicked_pdf
It worked on my windows xp.

from wicked_pdf.

unixmonkey avatar unixmonkey commented on August 27, 2024

The latest versions use branching logic to figure out whether to load open3 or win32/open3 when on windows.

from wicked_pdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.