ruby - Rails app hangs when using Wicked_pdf gem and wkhtmltopdf-binary-edge -


i'm trying print pdf of view using `'wicked_pdf' gem. first time use gem. i've read the documentation , googled around , found simular questions here on stack overflow nothing seems trick.

i've validated binaries ( see edit below) working fine, problem isn´t there.

i found 2 strange lines in terminal when running rails s( see edit @ bottom)

i've been searching solution 3 straight days, , can't figure out.

am missing here?

the server hangs output in terminal

rendered pages/partials/_travel_part.html.erb (36.6ms)   rendered users/show.html.erb within layouts/application (531.7ms)   rendered layouts/_navbar.html.erb (2.6ms)   rendered shared/_footer.html.erb (0.8ms) completed 200 ok in 1640ms (views: 1115.4ms | activerecord: 136.0ms) "***************[\"/usr/local/bin/wkhtmltopdf\", \"-q\", \"file:////var/folders/sm/zwm8cy0x73qb6q1pq22r4bjh0000gn/t/wicked_pdf20160913-35465-hkw9b8.html\", \"/var/folders/sm/zwm8cy0x73qb6q1pq22r4bjh0000gn/t/wicked_pdf_generated_file20160913-35465-10go9dt.pdf\"]***************" 

below have far.

i want print views/users/show.html.erb in users_controller.rb have code in showmethod

def show      @user = user.find(params[:id])   @users = user.order('created_at desc').paginate(page: params[:page], per_page: 30)  @paper = current_user.papers.build @electro = current_user.electros.build @hwater = current_user.hwaters.build @cleaning = current_user.cleanings.build @transport = current_user.transports.build  @papers = current_user.papers  respond_to |format|                 format.html {render layout:'application'}                 format.pdf {render pdf:"test",javascript_delay:2000,                 layout:'application',template:'users/show.pdf.erb'}         end end 

in application.html.erbi have in head using wicked pdf helper

 <%= wicked_pdf_stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>  <%= wicked_pdf_javascript_include_tag 'application', 'data-turbolinks-track' => true %>  <%= javascript_include_tag "http://www.google.com/jsapi"%>  <%= wicked_pdf_javascript_include_tag 'chartkick'%>   <%= csrf_meta_tags %> 

the button in views/users/show.html.erb

 <%= link_to 'download pdf', user_path(current_user, format: :pdf) %> 

in config/initializers/mime_types.rb have code

 mime::type.register "application/pdf", :pdf 

in config/initializers/wicked_pdf.rb have code

wickedpdf.config = {  #:wkhtmltopdf => '/usr/local/bin/wkhtmltopdf',  #:layout => "pdf.html",   :exe_path => '/usr/local/bin/wkhtmltopdf'  } 

and in gemfile.rb have 2 gems:

 gem 'wicked_pdf', '~> 1.0', '>= 1.0.6'  gem 'wkhtmltopdf-binary-edge' 

edit*

ok i've validated binaries working fine typing wkhtmltopdf google.com google in terminal. conclusion problem lies somewhere else in wkhtmltopdf. where? still can't find out...

(addingwickedpdf) $ wkhtmltopdf google.com    google loading pages (1/6) counting pages (2/6)                                                resolving links (4/6)                                                        loading headers , footers (5/6)                                            printing pages (6/6) done                                                                       (addingwickedpdf) $  

another edit

i noticed lines in terminal when started server rails s earlier night, don´t know means, i'm sure has app hanging when rendering pdf:

/users/dadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/http/mime_type.rb:163: warning: initialized constant mime::pdf /users/dadi/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/actionpack- 4.2.5/lib/action_dispatch/http/mime_type.rb:163: warning: previous definition of  pdf here 

it great if take @ , guide me right path here.

thanks in advance dh

the answer posted here:

how rails resolve multi-requests @ same time?

subsequently adapted question here (last answer):

pdfkit hangs when generating pdf image


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -