pdfkit

PDFkit hangs when generating a pdf with an image

此生再无相见时 提交于 2019-11-27 19:32:00
问题 I want to render a webpage as a PDF. It uses a single image, and I've read that you need to supply the absolute URL for PDFkit to be able to use the image, so my code is: = image_tag image_url(user.avatar) This works when viewed as HTML, and PDFkit is able to generate a PDF with the image removed. However, when using the image, it just hangs until I kill the server. How can I get this to work? Here's the full output when I kill the server: 2013-12-04 13:53:36.576 wkhtmltopdf[27410:507]

How to: output Euro symbol in pdfkit for nodejs

亡梦爱人 提交于 2019-11-27 18:55:53
问题 Is it possible to display the Euro symbol in pdfkit for nodejs without having to embed an external font? I am using pdfKit to generate invoices and would like to prefix my currency amounts with the Euro Symbol (€). I've tried a number of approaches and none worked: doc.font('Helvetica-Bold') .fontSize(12) .text('€', 10, 10); // Alt+0128 on keypad doc.font('Helvetica-Bold') .fontSize(12) .text('\u20AC', 10, 10); 回答1: Turns out it is a font issue: unicode works, but you have to make sure that

Why does PDFKit/wkhtmltopdf hang but renders PDF as expected when Rails app is killed?

二次信任 提交于 2019-11-27 17:31:21
Background After reading around it seemed to me that Prawn is out and wkhtmltopdf is in. It also seems like the PDFKit and wicked_pdf gems for Rails are the new cool. So I found a screencast by Ryan on how to use PDFKit . I installed everything, tested wkhtmltopdf on the CLI with no problems, fiddled around with Rails settingsto run multiple processes so the asset pipeline works, and all seemed good, except I'm still stuck at the very end of the process (actually getting the PDF response from the server). Question When I request a .pdf version of my view (I'm using the PDFKit Middleware option

Wrong highlight annotation on apple PDFKit

百般思念 提交于 2019-11-27 17:04:06
问题 I'm using PDFKit on iOS to highlight texts (PDF file). I do it by create a PDFAnnotation and add it to the selected text area. I want to highlight precisely the selected area but it always covers the whole line like the pics below. How can I create the annotation for the selected area only?? My code: let highlight = PDFAnnotation(bounds: selectionText.bounds(for: page), forType: PDFAnnotationSubtype.highlight, withProperties: nil) highlight.color = highlightColor page.addAnnotation(highlight)

Merging PDF Files in Cocoa

女生的网名这么多〃 提交于 2019-11-27 12:34:41
问题 I would like to concatenate several PDF files to form one single PDF. Now I've come so far that I know, PDFKit is the proper way to go (I guess). But I am not sure, how to accomplish the merging. Should I have one PDFDocument and several PDFPage and then call insertPage on the PDFDocument ? Or is there a much simpler way? I dont want to alter the PDFs contetwise, I just want to merge them. Thanks a lot! 回答1: As you indicated, you need one output PDFDocument object which will contain all pages

PDFKit - Custom Fonts - fs.readFileSync is not a function

家住魔仙堡 提交于 2019-11-27 06:14:26
问题 I'm using PDFKit for an application. I'm just using it in the Browser in an HTML file, with Javascript (no Node.js). I downloaded PDFKit from GitHub: https://github.com/devongovett/pdfkit/releases as well as Blob Stream: https://github.com/devongovett/blob-stream I'm trying to include a custom font per the documentation like so: doc.registerFont('Custom Font', 'fonts/GOODDP__.TTF'); doc.font('Custom Font').fontSize(fontSize).text($("#text1").val(), xPos, yPos, configObj); But I always get

How to avoid page break inside table row for wkhtmltopdf

老子叫甜甜 提交于 2019-11-26 17:13:15
I am generating pdf report from html page with one table . I am using wkhtmltopdf for the purpose. when pdf is generated it breaks anywhere in tr tag . I want to avoid it . Nenotlep Update 17.09.2015: Check the version you are using: wkhtmltopdf 0.12.2.4 is said to fix the problem (I have not checked) . This is a known issue in wkhtmltopdf. The page breaking algorithm used by webkit (the WK in WKhtmltopdf) doesn't really work well for large tables. I suggest breaking the table down to smaller chunks that are more easily split to pages and using the css a lot: table, tr, td, th, tbody, thead,

Can't create pdf using python PDFKIT Error : “ No wkhtmltopdf executable found:”

泄露秘密 提交于 2019-11-26 15:59:58
问题 I tried installing pdfkit Python API in my windows 8 machine. I'm getting issues related to path. Traceback (most recent call last): File "C:\Python27\pdfcre", line 13, in <module> pdfkit.from_url('http://google.com', 'out.pdf') File "C:\Python27\lib\site-packages\pdfkit\api.py", line 22, in from_url configuration=configuration) File "C:\Python27\lib\site-packages\pdfkit\pdfkit.py", line 38, in __init__ self.configuration = (Configuration() if configuration is None File "C:\Python27\lib\site

Create PDF with multiple pages

梦想的初衷 提交于 2019-11-26 14:52:57
问题 I need to implement a functionality of creating pdf with multiple pages of a text. class PDFCreator { func prepareData() -> Data { //1 let pdfMetaData = [ kCGPDFContextCreator: "PDF Creator", kCGPDFContextAuthor: "Pratik Sodha", kCGPDFContextTitle: "My PDF" ] //2 let format = UIGraphicsPDFRendererFormat() format.documentInfo = pdfMetaData as [String: Any] //3 let pageWidth = 8.5 * 72.0 let pageHeight = 11 * 72.0 let pageRect = CGRect(x: 0, y: 0, width: pageWidth, height: pageHeight) //4 let

How to avoid page break inside table row for wkhtmltopdf

萝らか妹 提交于 2019-11-26 06:05:07
问题 I am generating pdf report from html page with one table . I am using wkhtmltopdf for the purpose. when pdf is generated it breaks anywhere in tr tag . I want to avoid it . 回答1: Update 17.09.2015: Check the version you are using: wkhtmltopdf 0.12.2.4 is said to fix the problem (I have not checked). This is a known issue in wkhtmltopdf. The page breaking algorithm used by webkit (the WK in WKhtmltopdf) doesn't really work well for large tables. I suggest breaking the table down to smaller