pdfkit

Rails 4 pdfkit failed converting chartkick graph to pdf

こ雲淡風輕ζ 提交于 2019-12-01 13:23:08
I am using Rails 4 I followed instruction from https://github.com/pdfkit/pdfkit In controller I have respond_to do |format| format.html {render layout:'application'} format.csv {send_data @testdatares.to_csv} format.pdf { html = render_to_string(:layout => 'application' , :action => "testpage.html.erb"); kit = PDFKit.new(html); kit.stylesheets << "#{Rails.root}/app/assets/stylesheets/application.css"; send_data(kit.to_pdf, :filename => "some_name.pdf", :type => 'application/pdf') } end In application.html.erb I have <!DOCTYPE html> <html> <head> <title>STNEW</title> <%= stylesheet_link_tag

Rails 3 + PDFKit: How to convert a view to PDF?

假装没事ソ 提交于 2019-12-01 12:59:17
In my Rails 3 application on Windows I have the following page which shows a job receipt and lets user to edit it: http://localhost:3001/jobs/45/invoice I have also a "Create PDF" button in the bottom of the page. When pressed, create_pdf_invoice of my JobsController is called: def create_pdf_invoice job = Job.find(params[:id]) kit = PDFKit.new("<h1>Hello</h1><p>This is PDF!!!</p>", :page_size => "A4") file = kit.to_file("my_file_name.pdf") redirect_to(:action => 'index') end end All this works fine, i.e. the PDF is created! My question is how can I print the invoice itself rather than this

WKHTMLTOPDF with pdfkit on Rails ignoring table page breaks

一曲冷凌霜 提交于 2019-12-01 12:56:38
I know there are a lot of issues with wkhtmltopdf and page breaks that date back years, but I haven't worked out a solution yet. I'm using the PDFKit gem to generate my html pages into pdfs, but I don't want the pages to break in the middle of a table row. I'm using wkhtmltopdf-binary (0.9.9.3), which looks to be the most updated version My CSS: @media print { #scores table tr td, #scores table tr th { page-break-inside: avoid !important; } table, tr, td, th, tbody, thead, tfoot { page-break-inside: avoid !important; } } My table: <div class="score_table"> <table id="scores" class="print

Rails 3 + PDFKit Problem: Permission denied (Errno::EACCES)

和自甴很熟 提交于 2019-12-01 12:07:19
I would like to use PDFKit in my Rails 3 application on Windows . I installed wkhtmltopdf and the pdfkit gem. Here is the code that I use to create the PDF: class JobsController < ApplicationController def create_pdf_invoice kit = PDFKit.new("<h1>Hello</h1><p>This is PDF!!!</p>", :page_size => "A4") file = kit.to_file("my_first_pdf") # Error issued here!! ... end end I got the following error: Errno::EACCES in JobsController#create_pdf_invoice Permission denied - "c:\Program Files\wkhtmltopdf" "--page-size" "A4" "--margin-top" "0.75in" "--margin-right" "0.75in" "--margin-bottom" "0.75in" "-

Rails 4 pdfkit failed converting chartkick graph to pdf

时光怂恿深爱的人放手 提交于 2019-12-01 11:18:23
问题 I am using Rails 4 I followed instruction from https://github.com/pdfkit/pdfkit In controller I have respond_to do |format| format.html {render layout:'application'} format.csv {send_data @testdatares.to_csv} format.pdf { html = render_to_string(:layout => 'application' , :action => "testpage.html.erb"); kit = PDFKit.new(html); kit.stylesheets << "#{Rails.root}/app/assets/stylesheets/application.css"; send_data(kit.to_pdf, :filename => "some_name.pdf", :type => 'application/pdf') } end In

Rails 3 + PDFKit Problem: Permission denied (Errno::EACCES)

蹲街弑〆低调 提交于 2019-12-01 11:10:24
问题 I would like to use PDFKit in my Rails 3 application on Windows . I installed wkhtmltopdf and the pdfkit gem. Here is the code that I use to create the PDF: class JobsController < ApplicationController def create_pdf_invoice kit = PDFKit.new("<h1>Hello</h1><p>This is PDF!!!</p>", :page_size => "A4") file = kit.to_file("my_first_pdf") # Error issued here!! ... end end I got the following error: Errno::EACCES in JobsController#create_pdf_invoice Permission denied - "c:\Program Files\wkhtmltopdf

Add pdf annotation with PDF Kit in OS 10.12

半腔热情 提交于 2019-12-01 08:42:20
问题 Now the latest os10.12 operating system, PDF annotation can be displayed, but now I still have a problem, I recorded coordinate information in PDFView ->mouseDragged before, and then automatically will invoke the PDFView->drawPage function, this function I will draw the NSBezierPath curve to determine the dynamic annotation bounds. but now in the process of mouseDragged has not been call the drawPage:toContext function. So I can't see the dynamic curve of adding annotation. I use the refresh

PDFkit *.css stylesheets not being applied

那年仲夏 提交于 2019-11-30 20:41:34
I am trying to convert a html page that displays images from facebook cdn to pdf using pdfkit. I am using rails 4.2, pdfkit 0.6.2 and wkhtmltopdf-binary 0.9.9.3. # Gemfile gem 'pdfkit' gem 'wkhtmltopdf-binary' # controller def generate_pdf @booklet = Booklet.find params[:id] @cover = Image.last @images = @booklet.images.sort_by(&:uploaded_at) respond_to do |format| format.html format.pdf do html = render_to_string(layout: true , action: "generate_pdf.html.haml") kit = PDFKit.new(html, page_size: 'A4', orientation: 'Landscape') `sass vendor/assets/stylesheets/bootstrap.scss tmp/bootstrap.css`

PDFkit *.css stylesheets not being applied

泪湿孤枕 提交于 2019-11-30 04:47:59
问题 I am trying to convert a html page that displays images from facebook cdn to pdf using pdfkit. I am using rails 4.2, pdfkit 0.6.2 and wkhtmltopdf-binary 0.9.9.3. # Gemfile gem 'pdfkit' gem 'wkhtmltopdf-binary' # controller def generate_pdf @booklet = Booklet.find params[:id] @cover = Image.last @images = @booklet.images.sort_by(&:uploaded_at) respond_to do |format| format.html format.pdf do html = render_to_string(layout: true , action: "generate_pdf.html.haml") kit = PDFKit.new(html, page

Wkhtmltopdf Characters in single line partially cut between pages

我只是一个虾纸丫 提交于 2019-11-29 19:58:16
I am working in a project using ruby on rails(3.1). My requirement is to produce pdf from the html content. So I use pdfkit gem. In some pages, characters in single line partially cut between pages. When I convert html convert to pdf using pdfkit gem version of wkhtmltopdf: wkhtmltopdf -- 0.11.0 rc1 operating system: Linux CentOS 5.5 In the image below showing character partially cut between pages. Please suggest a solution. Example 1 Example 2 I just ran across this and found something that resolved the issue for me. In my particular case, there were divs with display: inline-block; margin