pdfkit

is it possible to access pdf outline when developing for iOS

人走茶凉 提交于 2019-12-14 04:07:50
问题 being that PDFKit is not available on iOS, how is it possible to get the outline of a pdf document in that environment? Is commercial libraries like FastPdfKit or PSPDFKit the only solution? 回答1: It's not TOO tricky to access the pdf outline. My outline parser has about 420 LOC. I'll post some snippets, so you'll get the idea. I can't post the full code as it's a commercial library. You basically start like this: CGPDFDictionaryRef outlineRef; if(CGPDFDictionaryGetDictionary(pdfDocDictionary,

pdfkit - returns a blank pdf with only requested URL

喜你入骨 提交于 2019-12-13 04:33:32
问题 I'm trying to render a webpage with pdfkit My code: import pdfkit config = pdfkit.configuration(wkhtmltopdf='/Library/Python/2.7/site-packages/wkhtmltopdf/wkhtmltopdf') pdfkit.from_string('http://stackoverflow.com', 'so.pdf', configuration=config) But this just returns a blank pdf with the requested URL at the top. When in terminal I run wkhtmltopdf directly... wkhtmltopdf http://stackoverflow.com so2.pdf It renders fine What am I doing wrong? 回答1: This works fine with me: >>> import pdfkit >

Generating file with PDFKit on Heroku - No such file or directory

余生长醉 提交于 2019-12-13 01:24:51
问题 I'm using PDFKit to create pdfs of from a given url within a Resque job on Heroku Cedar. My code looks like: kit = PDFKit.new(url) pdf = kit.to_file("/tmp/#{SecureRandom.hex}.pdf") I then upload the file using fog to S3 for permanent storage. This job usually works, but also fails maybe a third of the time with: No such file or directory - /tmp/a05c165fc80878b75fd15c447695de71.pdf Manually running through the code in console will produce the same error. According to the Heroku docs, I should

使用PDFKit和Node.js生成服务器端PDF文件

不羁的心 提交于 2019-12-12 18:24:13
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 介绍 起初,生成 PDF 文件似乎是件很繁琐的任务,但有了 PDFKit ,这个任务就容易多了。 但对于 Node.js 的 PDFKit 模块 ,知道的人并不多,这倒是很意外。有了 PDFKit 模块,处理 PDF 文件变得非常容易,它让你避免了所有的复杂工作,并提供用 CoffeeScript (也可以作为普通版的 Javascript 使用)写成的简易的 API 。本篇当中,我们一起来生成一个服务器端的带文本内容的简易 PDF 文件,用的就是 PDFKit 模块和 Node.js 。现在开始吧: 首先,大家都知道,我们用 npm 安装模块: npm install pdfkit 然后,创建一个 generatePDFDocument.js 文件,在里面写入下面代码: var PDF = require('pdfkit'); //including the pdfkit module var fs = require('fs'); var text = 'ANY_TEXT_YOU_WANT_TO_WRITE_IN_PDF_DOC'; doc = new PDF(); //creating a new PDF object doc.pipe(fs.createWriteStream('PATH_TO_PDF

是程序员,就用python导出pdf

血红的双手。 提交于 2019-12-12 18:24:03
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 这两天一直在做课件,我个人一直不太喜欢PPT这个东西……能不用就不用,我个人特别崇尚极简风。 谁让我们是程序员呢,所以就爱上了Jupyter写课件,讲道理markdown也是个非常不错的写书格式啊。 安装Jupyter其实非常简单,你会python就应该会用jupyter,起码简单的 pip install jupyter, jupyter notebook 要会对伐~ 好那接下来就是使用jupyter了,启动jupyter后,使用浏览器访问相应IP:Port就可以使用了。没错,jupyter就是这么一个可以用网站来写python的地方。 但是发讲义给同学们看,ipynb格式的文件肯定不方便啊,别人还没上课呢,哪知道那么多?再者PDF传阅起来也随时随地能打开啊。所以我就想转换成PDF。 但是打开文件,点击下载,发现出现了Error 然后照着这个Error,就去谷歌了,发现说的最多的就是要装一个latex环境,mac下完整的安装包要将近3个G!我就为了一个PDF还不需要这么大一个包吧?所以寻思其他方法。 虽然jupyter对PDF支持的不是那么的友善,但是对于html是非常棒的,只不过html是一个html嘛(这不是废话)……不过我可以利用html转换到pdf上啊。 后来了解到python有一个包叫 pdfkit

python使用pdfkit生成pdf【python】

旧街凉风 提交于 2019-12-12 16:48:15
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1.安装pdfkit pip3 install pdfkit 代码: html = '<html><head><meta charset="UTF-8"></head>' \ '<body><div align="center"><p>%s</p></div></body></html>' % text pdfkit.from_string(html, './result.pdf') 或者 pdfkit.from_file(1.html, './result.pdf') 2.测试运行 运行python3 test.py后报错 If this file exists please check that this process can read it. Otherwise please install wkhtmltopdf - https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf 缺少:wkhtmltopdf 进行安装 yum install wkhtmltopdf github地址: https://github.com/JazzCore/python-pdfkit/wiki/Installing-wkhtmltopdf

Chinese and Japanese character encoding issues when exporting HTML to PDF

余生长醉 提交于 2019-12-12 16:46:40
问题 I run a web-based timeline maker that lets users create timelines in HTML/JavaScript and then export them to PDF files for printing when they're done. I have had several users report issues with exporting their timelines to PDFs when the timelines contain certain Unicode characters. Here, for example, is a screenshot showing the web page and the PDF file that is generated: I've been trying to wrap my head around why some Unicode character blocks like Block Elements and Georgian will export

Download returning empty file

瘦欲@ 提交于 2019-12-12 16:27:08
问题 I'm building a node.js+express application in which the user will input some data, the generates a PDF with pdfkit and the file is sent to the user. I'm being able to generate the file successfully, the problem is that when I download the file generated, it's empty. I can't even open the PDF, the reader (Preview, native reader in macOS) says that the file is empty. I'm using the following code: var express = require('express'); var router = express.Router(); var guid = require('guid'); var

PDFkit rails3.1 and development env

徘徊边缘 提交于 2019-12-12 15:02:31
问题 My Rails 3.1 app is using PDFkit to render specific pages, and I'm running into (what seems like) a common problem with where trying to generate the pdf is causing the process to hang. I found this solution here on stackoverflow: rails 3 and PDFkit. Where I add a config.threadsafe! entry in my development.rb file and this works BUT it requires that for every change anywhere in the app I have to stop and restart my server to see my changes. NOT acceptable from a workflow - I'm currently

How to load images/precompiled assets with PDFKit/wkhtmltopdf? Rails 5.2

孤者浪人 提交于 2019-12-11 18:22:37
问题 I'm having some success with creating PDFs with PDFKit, but the images are not loading from active_storage and assets resources. It fails every single time that I create the PDF, using show.pdf.erb. I'm using the default image_tag and assets are precompiled for production. How can I get PDFKit to find the precompiled assets folder for the images, and also find active_storage images that are supposed to load within the show.pdf.erb view? It works perfectly fine in the normal show.html.erb