I have an application which takes in a zip file as its input. The zip file contains a html file, its css and the images. I need to convert this html to pdf and send back. I have looked at Prince XML and wicked PDF but dont know how to perform this exact task.
It is like my application should act as a HTML to PDF converter. They will send us zip files and my app should generate the corresponding PDF. How to go about this task.
You can use PDFKit gem.
https://github.com/jdpace/PDFKit
http://www.jonathanspies.com/posts/11-Simple-PDFkit-example-in-Rails-3
The process I would implement is:
Upload the zip via a form
Unzip the contents
Process the html file within using Hpricot or similar (if you need to tidy it up first)
Convert the raw html to PDF with https://github.com/jdpace/PDFKit
Related
I need to generate report to pdf file, save on the server, than send the file to the client by email.
I am looking to a gem for exporting pdf file
And I want to know if the file keep all the pdf options (like links and the option to select text copy text etc')
Thanks
You can use wicked_pdf gem to generate PDF from HTML. You can configure the options whatever you want in their advanced usage.
Wicked PDF is what you need. It will export to PDF and keep all links, text and images as a real PDF would, because it generates a real, full fledge PDF.
I am reading a PDF file stored locally (using nsbundle) and converting it to text.
But when I am trying to read the PDF from http i.e. URL scheme and give the path to my PDF to text converter it returns nil.
Any solutions would be appreciated.
My basic question is how to read a PDF file from a URL path?
on that way there are many restriction to convert PDF file to plain text.If you want to display PDF on app then use PDF Reader Core
I am working on Symfony-1.1 in an existing project. How can I read pdf files and extract text from them?
It's not a Symfony 1.1 related question, actually. It's a PHP one. There several libraries to handle PDFs in PHP. Following are some suggestions.
https://github.com/smalot/pdfparser
http://pastebin.com/dvwySU1a
http://www.pdflib.com/
If you just need to parse pdf in anyway and then process the text in PHP, you can also consider using a java library like the following.
http://pdfbox.apache.org/ (Is there a PDF parser for PHP?)
I need to generate a pdf file and upload it to the AWS upon some action from my controller. I've never done this before with rails, neither created a pdf and then upload it to the aws.
So here is what I'm thinking, how to proceed.
When a action in my controller occurs and it invokes a method a, it will invoke the Job B which is a delayed job who will call the controller method c which has the respond_to and format pdf. And the job will save the .pdf file to the AWS.
The pdf that I'm using needs to be stored on the aws so it can be emailed to a user later. Not sure if this is relevant, just wanted to give more details.
I'm using prawn gem to generate the pdf
Is there a better way to do this, has anyone done something like this before?
http://rubygems.org/gems/wicked_pdf
"Wicked PDF uses the shell utility wkhtmltopdf to serve a PDF file to a user from HTML. In other words, rather than dealing with a PDF generation DSL of some sort, you simply write an HTML view as you would normally, and let Wicked take care of the hard stuff."
I've done something similar using pdfkit. Essentially you just define your PDF layout in HTML/CSS, and when a user adds the .pdf suffic to a path, it attempts to generate the PDF. It's nice because you don't have to actually store generated PDF files, but they'll always be available if someone needs them.
I am trying to convert office files to PDF using POI and iText. I am able to do the basic conversion where I read the word file using WordExtractor and write the contents to PDF file using PDF writer.
However, this does not retain the structure (tables, styles etc). I have come across this forum that you can retain the formats using Tika. Are there any working examples for this?