diff --git a/Gemfile b/Gemfile index 212d05d..58de101 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gem 'rails', '~> 5.1.4' gem 'momentjs-rails', '>= 2.9.0' gem 'bootstrap3-datetimepicker-rails', '~> 4.14.30' gem 'devise' - +gem 'cocoon' gem 'mysql2' # Use Puma as the app server gem 'puma', '~> 3.7' @@ -36,7 +36,7 @@ gem 'jbuilder', '~> 2.5' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development gem 'wicked_pdf' -#gem 'wkhtmltopdf-binary' +gem 'wkhtmltopdf-binary'#, '0.9.9' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platform: :mri diff --git a/Gemfile.lock b/Gemfile.lock index 714d3b4..9cf2107 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,175 +1,193 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.0.0.1) - actionpack (= 5.0.0.1) - nio4r (~> 1.2) + actioncable (5.1.4) + actionpack (= 5.1.4) + nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.0.1) - actionpack (= 5.0.0.1) - actionview (= 5.0.0.1) - activejob (= 5.0.0.1) + actionmailer (5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.0.1) - actionview (= 5.0.0.1) - activesupport (= 5.0.0.1) + actionpack (5.1.4) + actionview (= 5.1.4) + activesupport (= 5.1.4) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.0.1) - activesupport (= 5.0.0.1) + actionview (5.1.4) + activesupport (= 5.1.4) builder (~> 3.1) - erubis (~> 2.7.0) + erubi (~> 1.4) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (5.0.0.1) - activesupport (= 5.0.0.1) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.1.4) + activesupport (= 5.1.4) globalid (>= 0.3.6) - activemodel (5.0.0.1) - activesupport (= 5.0.0.1) - activerecord (5.0.0.1) - activemodel (= 5.0.0.1) - activesupport (= 5.0.0.1) - arel (~> 7.0) - activesupport (5.0.0.1) + activemodel (5.1.4) + activesupport (= 5.1.4) + activerecord (5.1.4) + activemodel (= 5.1.4) + activesupport (= 5.1.4) + arel (~> 8.0) + activesupport (5.1.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) - arel (7.1.2) + arel (8.0.0) + bcrypt (3.1.11) bcrypt (3.1.11-x64-mingw32) bcrypt (3.1.11-x86-mingw32) + bindex (0.5.0) bootstrap3-datetimepicker-rails (4.14.30) momentjs-rails (>= 2.8.1) - builder (3.2.2) - coffee-rails (4.2.1) + builder (3.2.3) + byebug (9.1.0) + cocoon (1.2.11) + coffee-rails (4.2.2) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.2.x) + railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.8.0) - concurrent-ruby (1.0.2) - debug_inspector (0.0.2) - devise (4.2.0) + concurrent-ruby (1.0.5) + crass (1.0.3) + devise (4.3.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0, < 5.1) + railties (>= 4.1.0, < 5.2) responders warden (~> 1.2.3) - erubis (2.7.0) + erubi (1.7.0) execjs (2.7.0) - globalid (0.3.7) - activesupport (>= 4.1.0) - i18n (0.7.0) - jbuilder (2.6.0) - activesupport (>= 3.0.0, < 5.1) - multi_json (~> 1.2) - jquery-rails (4.2.1) + ffi (1.9.18) + ffi (1.9.18-x64-mingw32) + ffi (1.9.18-x86-mingw32) + globalid (0.4.1) + activesupport (>= 4.2.0) + i18n (0.9.1) + concurrent-ruby (~> 1.0) + jbuilder (2.7.0) + activesupport (>= 4.2.0) + multi_json (>= 1.2) + jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - loofah (2.0.3) + loofah (2.1.1) + crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.4) - mime-types (>= 1.16, < 4) - method_source (0.8.2) - mime-types (3.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_portile2 (2.1.0) - minitest (5.9.1) - momentjs-rails (2.15.1) + mail (2.7.0) + mini_mime (>= 0.1.1) + method_source (0.9.0) + mini_mime (1.0.0) + mini_portile2 (2.3.0) + minitest (5.10.3) + momentjs-rails (2.17.1) railties (>= 3.1) - multi_json (1.12.1) - mysql2 (0.4.4-x64-mingw32) - mysql2 (0.4.4-x86-mingw32) - nio4r (1.2.1) - nokogiri (1.6.8-x64-mingw32) - mini_portile2 (~> 2.1.0) - pkg-config (~> 1.1.7) - nokogiri (1.6.8-x86-mingw32) - mini_portile2 (~> 2.1.0) - pkg-config (~> 1.1.7) + multi_json (1.12.2) + mysql2 (0.4.10) + mysql2 (0.4.10-x64-mingw32) + mysql2 (0.4.10-x86-mingw32) + nio4r (2.1.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) + nokogiri (1.8.1-x64-mingw32) + mini_portile2 (~> 2.3.0) + nokogiri (1.8.1-x86-mingw32) + mini_portile2 (~> 2.3.0) orm_adapter (0.5.0) - pkg-config (1.1.7) - puma (3.6.0) - rack (2.0.1) - rack-test (0.6.3) - rack (>= 1.0) - rails (5.0.0.1) - actioncable (= 5.0.0.1) - actionmailer (= 5.0.0.1) - actionpack (= 5.0.0.1) - actionview (= 5.0.0.1) - activejob (= 5.0.0.1) - activemodel (= 5.0.0.1) - activerecord (= 5.0.0.1) - activesupport (= 5.0.0.1) - bundler (>= 1.3.0, < 2.0) - railties (= 5.0.0.1) + puma (3.11.0) + rack (2.0.3) + rack-test (0.8.2) + rack (>= 1.0, < 3) + rails (5.1.4) + actioncable (= 5.1.4) + actionmailer (= 5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) + activemodel (= 5.1.4) + activerecord (= 5.1.4) + activesupport (= 5.1.4) + bundler (>= 1.3.0) + railties (= 5.1.4) sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.1) - activesupport (>= 4.2.0, < 6.0) - nokogiri (~> 1.6.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (5.0.0.1) - actionpack (= 5.0.0.1) - activesupport (= 5.0.0.1) + railties (5.1.4) + actionpack (= 5.1.4) + activesupport (= 5.1.4) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (11.3.0) - responders (2.3.0) - railties (>= 4.2.0, < 5.1) - sass (3.4.22) - sass-rails (5.0.6) + rake (12.3.0) + rb-fsevent (0.10.2) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + responders (2.4.0) + actionpack (>= 4.2.0, < 5.3) + railties (>= 4.2.0, < 5.3) + sass (3.5.3) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (5.0.7) railties (>= 4.0.0, < 6) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sprockets (3.7.0) + sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.0) + sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - thor (0.19.1) - thread_safe (0.3.5) - tilt (2.0.5) + thor (0.20.0) + thread_safe (0.3.6) + tilt (2.0.8) turbolinks (5.0.1) turbolinks-source (~> 5) - turbolinks-source (5.0.0) - tzinfo (1.2.2) + turbolinks-source (5.0.3) + tzinfo (1.2.4) thread_safe (~> 0.1) - tzinfo-data (1.2016.7) + tzinfo-data (1.2017.3) tzinfo (>= 1.0.0) - uglifier (3.0.2) + uglifier (4.0.1) execjs (>= 0.3.0, < 3) - warden (1.2.6) + warden (1.2.7) rack (>= 1.0) - web-console (3.3.1) + web-console (3.5.1) actionview (>= 5.0) activemodel (>= 5.0) - debug_inspector + bindex (>= 0.4.0) railties (>= 5.0) - websocket-driver (0.6.4) + websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.2) + websocket-extensions (0.1.3) wicked_pdf (1.1.0) + wkhtmltopdf-binary (0.12.3.1) PLATFORMS + ruby x64-mingw32 x86-mingw32 DEPENDENCIES bootstrap3-datetimepicker-rails (~> 4.14.30) byebug + cocoon coffee-rails (~> 4.2) coffee-script-source (= 1.8.0) devise @@ -177,14 +195,15 @@ DEPENDENCIES jquery-rails momentjs-rails (>= 2.9.0) mysql2 - puma (~> 3.0) - rails (~> 5.0.0, >= 5.0.0.1) + puma (~> 3.7) + rails (~> 5.1.4) sass-rails (~> 5.0) turbolinks (~> 5) tzinfo-data uglifier (>= 1.3.0) web-console wicked_pdf + wkhtmltopdf-binary BUNDLED WITH - 1.13.2 + 1.16.0 diff --git a/app/controllers/invoices_controller.rb b/app/controllers/invoices_controller.rb index 40ba83a..b005758 100644 --- a/app/controllers/invoices_controller.rb +++ b/app/controllers/invoices_controller.rb @@ -15,11 +15,12 @@ class InvoicesController < ApplicationController layout: 'pdf', encoding: 'UTF-8', page_size: 'A4', + print_media_type: true, margin: { top: 8, # default 10 (mm) bottom: 8, left: 8, right: 8 }, - viewport_size: '1280x1024' + viewport_size: '1336x1024' end end end diff --git a/config/initializers/wicked_pdf.rb b/config/initializers/wicked_pdf.rb index 116a9ff..bdbeded 100644 --- a/config/initializers/wicked_pdf.rb +++ b/config/initializers/wicked_pdf.rb @@ -11,10 +11,12 @@ WickedPdf.config = { # Path to the wkhtmltopdf executable: This usually isn't needed if using # one of the wkhtmltopdf-binary family of gems. - exe_path: 'c:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe', - # exe_path: '/usr/local/rvm/gems/ruby-2.2.5/gems/wkhtmltopdf-binary-0.9.9/bin/wkhtmltopdf_linux_x64' + # exe_path: 'c:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe', + # exe_path: '/usr/local/rvm/gems/ruby-2.4.1/gems/wkhtmltopdf-binary-0.12.3.1/bin/wkhtmltopdf_linux_x86', +# exe_path: '/usr/local/rvm/gems/ruby-2.4.1/gems/wkhtmltopdf-binary-0.9.9/bin/', + exe_path: '/usr/bin/wkhtmltopdf', # or - #exe_path: Gem.bin_path('wkhtmltopdf-binary', 'wkhtmltopdf') + # exe_path: Gem.bin_path('wkhtmltopdf-binary', 'wkhtmltopdf'), # Layout file to be used for all PDFs # (but can be overridden in `render :pdf` calls)