pdfkit

HTML to PDF with Wicked PDF and letter-spacing issues

China☆狼群 提交于 2019-12-04 07:48:12
Using both 0.79 and 0.7.2 the PDF generated looks slightly different than my original HTML. Adding the show_as_html flag presents it as expected however the inline-styles are being handled differently in the PDF then they are in the HTML preview. Specifically the problem I'm having is with letter-spacing declarations which also have a float not being rendered correctly. So for instance on a right float element which has the letter-spacing, the PDF will space the characters too much and from center such that the text goes partially off the screen rather than bumping further to left for the

Rails development server, PDFKit and multithread

╄→гoц情女王★ 提交于 2019-12-04 07:18:58
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 lot. The simplest solution I have found is unicorn . gem install unicorn Create a unicorn.conf : worker

how to create a pdf from image which taken by camera with pdfkit

倾然丶 夕夏残阳落幕 提交于 2019-12-04 06:25:14
问题 Hi I am new to pdfkit and iOS applications, I want to take a picture with device and then convert the image to pdf. taking pictures with camera and saving it on Camera Roll works completely fine, the problem is when I want to create pdf from that image it needs the name of the image, how I can find it? and another question is it possible to implement any pdf editor with pdfkit to edit image? Appreciate any help. below is my imagePickerController codes. func imagePickerController(_ picker:

Save PDF file shown by PDFKit middleware

China☆狼群 提交于 2019-12-04 05:37:20
If somebody is interested in saving the PDF file in the filesystem which is shown by PDFKit middleware gem, then here it is... Override the call method of middleware.rb file. In overriding just replace this line: body = PDFKit.new(translate_paths(body, env), @options).to_pdf with pdf = PDFKit.new(translate_paths(body, env), @options) file = pdf.to_file('Your/file/name/path') Mymodel.my_method() #You can write your method here to use that file body = pdf.to_pdf #Here you can change the response body You can also override the response-body and content-type if you don't want to give pdf response.

PdfKit highlight annotation

时间秒杀一切 提交于 2019-12-03 13:13:15
问题 I'm trying to add highlight annotations to documents using PDFKit on iOS. let highlight = PDFAnnotation(bounds: selection.bounds(for: page), forType: PDFAnnotationSubtype.highlight, withProperties: nil) highlight.color = color page.addAnnotation(highlight) page.displaysAnnotations = true When adding them using the code above, they appear as two differently shaped layers. When saving them to the PDF file and reopening it they display correctly. In this screen capture The top and bottom

Writing metadata to a pdf using pyobjc

孤人 提交于 2019-12-03 08:41:25
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 document" print "reading pdf file" attrs = {} attrs[PDFDocumentTitleAttribute] = "THIS IS THE TITLE" attrs[PDFDocumentAuthorAttribute] = "A. Author and B. Author" PDFDocumentTitleAttribute = "test" pdfdoc.setDocumentAttributes_(attrs) pdfdoc.writeToFile_("mynewfile.pdf") print "pdf made" This appears to work fine (no errors to the consoled), however when

PdfKit highlight annotation

坚强是说给别人听的谎言 提交于 2019-12-03 03:18:51
I'm trying to add highlight annotations to documents using PDFKit on iOS. let highlight = PDFAnnotation(bounds: selection.bounds(for: page), forType: PDFAnnotationSubtype.highlight, withProperties: nil) highlight.color = color page.addAnnotation(highlight) page.displaysAnnotations = true When adding them using the code above, they appear as two differently shaped layers. When saving them to the PDF file and reopening it they display correctly. In this screen capture The top and bottom highlights have been added the same way using the snippet provided here. The top one has been saved to the pdf

There's problem with PDFKit appeared after update to Xcode 10.2. Is there any way to solve?

故事扮演 提交于 2019-12-02 17:35:28
问题 The app crashes when I try to use pdfkit to display pdf-file. Here's the simple example​: import UIKit import PDFKit class ViewController: UIViewController { @IBOutlet weak var pdfView: PDFView! override func viewDidLoad() { super.viewDidLoad() if let path = Bundle.main.path(forResource: "file", ofType: "pdf") { let url = URL(fileURLWithPath: path) if let pdfDocument = PDFDocument(url: url) { pdfView.displayMode = .singlePageContinuous pdfView.autoScales = true // pdfView.displayDirection =

how to create a pdf from image which taken by camera with pdfkit

戏子无情 提交于 2019-12-02 11:54:36
Hi I am new to pdfkit and iOS applications, I want to take a picture with device and then convert the image to pdf. taking pictures with camera and saving it on Camera Roll works completely fine, the problem is when I want to create pdf from that image it needs the name of the image, how I can find it? and another question is it possible to implement any pdf editor with pdfkit to edit image? Appreciate any help. below is my imagePickerController codes. func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { let pickedImage = info

PDFkit doesn't display pictures in PDF

╄→гoц情女王★ 提交于 2019-12-01 16:44:23
Rails 2, PDFkit 0.5.0 Im generating a PDF from a View in Rails 2 with PDFkit and everything works fine. The only thing which doesn't work is displaying pictures in the pdf. When I look at the View in the Browser, the picture is there but its missing in the PDF. There is only a placeholder existing in the PDF. The image_tag is looking like this: <%= image_tag('plus.gif') %> I also tried to realize it with a css-file but it doesn't work either. Any ideas? nfm Because of the way that wkhtmltopdf works you need to specify the full path to any assets (JS, CSS, images etc), including the domain name