Solved this by adding <!DOCTYPE html> at the top of the header HTML file. Somewhat capricious, I know......
python,pdf-generation,pdfkit,stringio
It's not your fault. This happens because pdf kit assumes each element in the list as a file path instead of file descriptor. here is the relevant code. I had a similar situation of HTML spread across multiple templates. I put them all in one string and pass the StringIO...
javascript,pdf,pdf-generation,pdfkit,node-pdfkit
I found a solution as per this https://github.com/devongovett/pdfkit/blob/master/lib/image.coffee just make sure your name your png files with at capital ending .PNG, it worked for me.
Assuming, you are trying to download the pdf file. see the code below: #users_controller.rb: class UsersController < ApplicationController def download_pdf pdf = render_to_string(pdf: "test.pdf", template: "users/test.html.erb", encoding: "UTF-8") send_data pdf end end # Gemfile source 'https://rubygems.org' gem 'rails', '3.2.19' gem 'sqlite3' group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails',...
You can include your stylesheets by following: def download_pdf kit = PDFKit.new(File.open(Rails.root.join('app', 'views', 'users', 'download.html.erb'))) kit.stylesheets << Rails.root.join("app","assets","application.css") send_data(kit.to_pdf, :filename => 'report.pdf', :type => 'application/pdf', :disposition => 'inline') end ...
Looks like it will work fine if I use doc.pipe res instead of doc.pipe fs.createWriteStream(res)
ruby-on-rails,pdf,append,pdfkit
<tr> shortened for brevity's sake <td><%= link_to 'Show', certification %></td> <td><%= link_to 'Edit', edit_certification_path(certification) %></td> <td><%= link_to 'Destroy', certification, method: :delete, data: { confirm: 'Are you sure?' } %></td> <td><%= link_to "Download PDF", certification_path(@certification, :format => "pdf") %></td> </tr> Okay from your code it seems you have used certification and...