title: ruby on rails (wkhtmltopdf header footer issue)
body: <p>In local environment pdf with header footer generated successfully. but in hosting linux server environment pdf generated without header and footer.Below is my wkhtmltopdf (WickedPdf) config</p>
  
  <pre><code>WickedPdf.config = {
      #:wkhtmltopdf =&gt; "#{RAILS_ROOT}/pdfbin/wkhtmltopdf-amd64",
      :exe_path =&gt; "/home/software/.gems/bin/wkhtmltopdf",
      :layout =&gt; "layouts/pdf.html.erb",
      :margin =&gt; {    :top=&gt; 40,
                      :bottom =&gt; 20,
                      :left=&gt; 30,
                      :right =&gt; 30},
      :header =&gt; {:html =&gt; { :template=&gt; 'layouts/pdf_header.html.erb'}},
      :footer =&gt; {:html =&gt; { :template=&gt; 'layouts/pdf_footer.html.erb'}}
      #:exe_path =&gt; '/usr/bin/wkhtmltopdf'
  }
  </code></pre>
  
  <p><strong>for additional info :</strong></p>
  
  <p>this is my dir structure i am on linux rails hosting app\views\layouts , inside layouts i am having pdf.html.erb , pdf_footer.html.erb , pdf_header.html.erb 
  The above stuff works perfectly on my local windows development environment , but in production pdf generated without headers and footers.so guys please help me to produce pdf with headers and footers</p>
  
  <p><strong>app/views/layouts/pdf.html.erb</strong></p>
  
  <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html dir="&lt;%= (rtl?) ? 'rtl' : 'ltr' %&gt;"&gt;
    &lt;head&gt;
      &lt;% @direction = (rtl?) ? 'rtl/' : '' %&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt; 
      &lt;%= stylesheet_link_tag([@direction+'application', @direction+'_styles/ui.all'])%&gt;
      &lt;%= stylesheet_link_tag(*get_stylesheets) %&gt;
      &lt;%= stylesheet_link_tag  @direction+"_layouts/pdf" %&gt;
      &lt;link rel="stylesheet" type="text/css" href="&lt;%="#{RAILS_ROOT}/public/stylesheets/#{@direction}_layouts/pdf.css" %&gt;" media="all" /&gt;
      &lt;link rel="stylesheet" type="text/css" href="&lt;%="#{RAILS_ROOT}/public/stylesheets/#{get_stylesheets}.css"%&gt;" media="all" /&gt;
      &lt;link rel="stylesheet" type="text/css" href="&lt;%= "#{RAILS_ROOT}/public/stylesheets/#{@direction}_styles/ui.all.css"%&gt;" media="all" /&gt;
  
  
    &lt;/head&gt;
    &lt;body&gt;
  
      &lt;%= yield %&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>app/views/layouts/pdf_header.html.erb</strong></p>
  
  <pre><code>&lt;div id="pdf-header"&gt;
        &lt;div class="logo"&gt;
          &lt;% if FileTest.exists?("#{RAILS_ROOT}/public/uploads/image/institute_logo.jpg") %&gt;
              &lt;%= image_tag  "#{request.protocol}#{request.host_with_port}/uploads/image/institute_logo.jpg" ,:width =&gt; "90",  :height=&gt;"85" %&gt;
            &lt;% else %&gt;
  
            &lt;div class="fed_logo"&gt;
              &lt;%= image_tag  "#{request.protocol}#{request.host_with_port}/images/application/app_fedena_logo.jpg" ,:width =&gt; "90",  :height=&gt;"85" %&gt;
      &lt;/div&gt;
            &lt;% end %&gt;
        &lt;/div&gt;
        &lt;div class="header-content"&gt;
          &lt;p&gt;&lt;%=Configuration.get_config_value('InstitutionName'); %&gt;&lt;/p&gt;
          &lt;p&gt;&lt;%=Configuration.get_config_value('InstitutionAddress'); %&gt;&lt;/p&gt;
        &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>app/views/layouts/pdf_footer.html.erb</strong></p>
  
  <pre><code>&lt;div id="pdf-footer"&gt;
    &lt;%= t('signature') %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Note*</strong> The above codes working perfectly on my windows development environment (ie) PDF generated properly with header and footers. <strong>But when i hosted my application in linux production server PDF generated without headers and footers.*</strong></p>
  
  <hr>
  
  <h2>Resolved Header Footer Issue , the above is the working code. The above problem is due to my files don't have enough executable permissions in production Linux environment.</h2>
  
  <hr>