pdfkit

Sending a PDF created dynamically as an attachment using PDFKit in a nodejs application

不羁岁月 提交于 2019-12-08 04:52:49
问题 I am trying to create a pdf dynamically using PDFkit and want to send it as an attachment in a email. Following this http://pdfkit.org/demo/browser.html example and this https://nodemailer.com/using-attachments/ documentation I wrote the following code: var doc = new PDFDocument(); var stream = doc.pipe(blobStream()); doc.text("Howdy!!"); doc.on('end'); stream.on('finish', function() { var htmlMailBody ='Hi' var textMailBody = 'hi'; var mailOptions = { from: 'ASD', // sender address to:

Sending a PDF created dynamically as an attachment using PDFKit in a nodejs application

試著忘記壹切 提交于 2019-12-07 04:02:28
I am trying to create a pdf dynamically using PDFkit and want to send it as an attachment in a email. Following this http://pdfkit.org/demo/browser.html example and this https://nodemailer.com/using-attachments/ documentation I wrote the following code: var doc = new PDFDocument(); var stream = doc.pipe(blobStream()); doc.text("Howdy!!"); doc.on('end'); stream.on('finish', function() { var htmlMailBody ='Hi' var textMailBody = 'hi'; var mailOptions = { from: 'ASD', // sender address to: 'ecell@sfitengg.org', // list of receivers subject: 'Invitation ', // Subject line text: textMailBody, //

render_to_string does not find partials (PDFKit controller response)

不问归期 提交于 2019-12-06 19:05:10
问题 Ruby 1.8.7, Rails 3.0.4, PDFKit 0.5.0 I'm trying to create a PDF with PDFKit without using the middleware so I can disable javascript (there's an accordion action in there that hides a lot of info that should be on the PDF). However, whenever I try, it fails because it says the partials in my view (show.html.erb) are missing: Missing partial programs/details with {:locale=>[:en, :en], :formats=>[:pdf], :handlers=>[:erb, :rjs, :builder, :rhtml, :rxml]} If I remove the references to the

How to link stylesheet files to pdfkit in Flask application?

怎甘沉沦 提交于 2019-12-06 13:32:28
问题 I am trying to create pdf from html page using pdfkit inside Flask application, but I have troubles to load the static files (stylesheets) when using pdfkit . I've tried to come up with minimal example. I've got this file structure App |_ static | |- style.css |_ templates | |- base.html |_ pdfs | |- file.pdf |_ application.py Inside application.py : import flask import pdfkit app = flask.Flask(__name__) @app.route('/') def index(): page = flask.render_template('base.html') pdfkit.from_string

Rails development server, PDFKit and multithread

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 02:20:20
问题 I have a rails app that uses PDFKit to render pdf versions of webpages. I use Thin as a development server. The problem is that when i'm in development mode. When I start my server with "bundle exec rails s" and I try to render any PDF the whole process gets deadlocked because when you render a PDF some extra resources like images and css are requested to the server and looks like there is a single thread. How can I configure rails development server to run multiple worker threads? Thanks a

pdfkit not rendering correctly in rails 3.1

自作多情 提交于 2019-12-05 19:48:47
I have followed the following railscast about adding pdfkit to an application, and I am having some issues with the generation of pdfs. Here are the following things that I have done: I downloaded wkhtmltopdf via the homebrew package manager brew install wkhtmltopdf Then I added the pdfkit gem to my gemfile and ran the bundle install command. I added the following to my config/application.rb file require 'pdfkit' ... config.middleware.use PDFKit::Middleware, :print_media_type => true I then changed my application layout file to include all stylesheet types. If I run rake middleware, the

PDFKit - PDFView using pageViewController - page rendering slow when swiping to next page

情到浓时终转凉″ 提交于 2019-12-05 03:28:05
I have a PDFView that's set to use a pageViewController: let pdfView = PDFView() let pdfDoc = PDFDocument(url: Bundle.main.url(forResource: "test", withExtension: "pdf")!) pdfView.document = pdfDoc pdfView.autoScales = true pdfView.displayDirection = .horizontal pdfView.usePageViewController(true, withViewOptions: [:]) Whenever I swipe to get to the next page, said next page is blurry for half a second before it's rendered sharply. That is quite annoying. Can I somehow preload the pages? I haven't found any attributes/methods in the documentation. (Interestingly, I have the exact same problem

render_to_string does not find partials (PDFKit controller response)

我怕爱的太早我们不能终老 提交于 2019-12-05 01:52:15
Ruby 1.8.7, Rails 3.0.4, PDFKit 0.5.0 I'm trying to create a PDF with PDFKit without using the middleware so I can disable javascript (there's an accordion action in there that hides a lot of info that should be on the PDF). However, whenever I try, it fails because it says the partials in my view (show.html.erb) are missing: Missing partial programs/details with {:locale=>[:en, :en], :formats=>[:pdf], :handlers=>[:erb, :rjs, :builder, :rhtml, :rxml]} If I remove the references to the partials, it works fine. I've also tried putting the partials in the same directory with show.html.erb to no

Highcharts charts on a page not rendering correctly when output to PDF using wkhtmltopdf

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 19:31:53
My wkhtmltopdf PDF output of a page with several Highcharts charts on it is missing some elements of the charts, primarily all of the simple straight lines, including tick marks, grid lines, column borders, legend borders and the lines in my line/spline charts (data points display). I have tried the tricks used to solve this issue from other stack questions, namely setting all of the following on the series: enableMouseTracking: false, shadow: false, animation: false ...as well as setting those on the column/spline. No luck. Here is a link to an image of the browser page . Here is a link to an

How to link stylesheet files to pdfkit in Flask application?

你说的曾经没有我的故事 提交于 2019-12-04 18:11:44
I am trying to create pdf from html page using pdfkit inside Flask application, but I have troubles to load the static files (stylesheets) when using pdfkit . I've tried to come up with minimal example. I've got this file structure App |_ static | |- style.css |_ templates | |- base.html |_ pdfs | |- file.pdf |_ application.py Inside application.py : import flask import pdfkit app = flask.Flask(__name__) @app.route('/') def index(): page = flask.render_template('base.html') pdfkit.from_string(page, 'pdfs/file.pdf') return page @app.route('/download', methods=['POST']) def download(): if flask