Questions tagged [pdfkit]

PDFKit is a PDF document generation library built on top of wkhtmltopdf to convert HTML+CSS to pdf using Webkit.

Project homepage

PDFKit is for creating PDFs using plain old HTML+CSS. Uses wkhtmltopdf on the back-end which renders HTML using Webkit.

PDFKit comes with a middleware that allows users to get a PDF view of any page on your site by appending .pdf to the URL.

Uses wkhtmltopdf on the back-end which renders HTML using Webkit.

1084 questions
7
votes
2 answers

page number in pdf converted from html - pdfkit, python/django

I am using pdfkit with python/django to convert rendered html to pdf. How can page numbers be added in the pdf liike page 1 of 4. I am converting html to string then passing it to from_string method of pdfkit.
Vinayak
  • 87
  • 1
  • 1
  • 6
7
votes
2 answers

pdfkit does not load css and JavaScript

I'm currently building a web application using Flask. My supervisor requested that one feature should be to save the current page as a PDF (for printing). To this end I'm using pdfkit. Before anyone proposes to use weasyprint instead: I tried…
Tingiskhan
  • 1,305
  • 3
  • 16
  • 29
7
votes
1 answer

PDFkit *.css stylesheets not being applied

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 …
Prasad Surase
  • 6,486
  • 6
  • 39
  • 58
7
votes
3 answers

PDFKit - locate image in center

Using PDFKit on node.js: var PDFDocument = require('pdfkit') var doc = new PDFDocument() doc.image('images/test.jpeg') How can I centerize an image added to the PDF? Is it optional to do it using PDFKit or do I need to use another library?
griffon vulture
  • 6,594
  • 6
  • 36
  • 57
7
votes
2 answers

Rails PDFKit wait for client side

I have successfully implemented PDFKit into my Rails application. But my application is mostly client side. I have lots of javascript widgets and it takes around 3 seconds for all of them to load. When I generate the pdf I can see some of the…
7
votes
2 answers

Can pdf kit save images from a url?

I have a node.js application in which I'm using pdfkit to generate pdf documents. I want to be able to include images from a url in the pdf. I cant save the image to the file system because my runtime environment is read only and pdf kit seems to…
jokham
  • 265
  • 4
  • 13
6
votes
1 answer

How to add line break in pdf generated using pdfkit.from_string()?

I try to generate a pdf file from a string using pdfkit. However, in the result all new line characters \n are ignored. Thus, I get a pdf with a string printed as a single sentence. For example: import pdfkit s = "Some text\n" s += "Ok, let's add…
Qiu
  • 5,651
  • 10
  • 49
  • 56
6
votes
1 answer

Firebase Storage and PDFkit. How specify MIME type?

I am trying to create a PDF file using Firebase Functions and save it to Firebase Storage. I used the code I found in this answers. const functions = require('firebase-functions'); const admin = require('firebase-admin'); const pdfkit =…
6
votes
2 answers

Passing data in UIViewControllerRepresentable

I'm trying to make a PDFView with UIKit and pass it data from a previous SwiftUI view. The data itself is a string with the name of the file. Somehow, the string is not passed from the UIViewControllerRepresentable to the UIViewController and it…
6
votes
1 answer

FileNotFoundError: [Errno 2] No such file or directory: 'which' when using python pdfkit

I have a strange error. I try to use pdfkit to convert an HTML string to PDF, but i get a "No such file or directory: 'which'". I know that pdfkit uses wkhtmltopdf, and it tries to find this utility by using which. I have no idea what's happening.…
Ruben
  • 1,065
  • 5
  • 18
  • 44
6
votes
1 answer

Key/values for usePageViewController's options

What key/values can I specify in withViewOptions parameter of usePageViewController method of PDFView of iOS11, PDFKit?
6
votes
2 answers

pdfkit - An A4 html page does not print into an A4 pdf

I have reproduced my problem below : I draw a 210x297 rectangle on a web page
Laurent
  • 61
  • 1
  • 3
6
votes
0 answers

Can't Convert SVG to PDF with PDFKit in Python without Loosing Images

I am having trouble converting my .SVG files to .PDF's. I am embedding the .SVG code inside html and trying to load the pdf from a string. Everything shows up fine except for the embedded images. They don't show up at all. Here is an example of the…
6
votes
2 answers

Writing metadata to a pdf using pyobjc

I'm trying to write metadata to a pdf file using the following python code: from Foundation import * from Quartz import * url = NSURL.fileURLWithPath_("test.pdf") pdfdoc = PDFDocument.alloc().initWithURL_(url) assert pdfdoc, "failed to create…
djq
  • 14,810
  • 45
  • 122
  • 157
6
votes
1 answer

Generate Arabic content with PDFKit & nodeJS

i'm using pdfkit with nodejs to generate dynamically PDF files. the generation works fine but i have a problem displaying arabic characters even if i setup a font that support arabic. The letters are rendered correctly, but the words are displayed…
ahai
  • 61
  • 2