How do I create a .pdf file efficiently from an HTML template in Rails?
-
i would like to print a web page, so I can keep formatting and templating tasks at HTML/CSS editing level.
-
Answer:
I've used WkHTMLtpPDF in the past (http://code.google.com/p/wkhtmltopdf/ http://plessl.github.com/wkpdf/) and it worked nice even on heroku
Emanuele DelBono at Quora Visit the source
Other answers
There are options like prawn, but they rely on a specific DSL. I am guessing you would like to print a pdf version of an existing view. I would recommend looking into pdfkit. We have used it in the past, and although it has some issues, it works quite well. https://github.com/jdpace/PDFKit/
Abhishiv Saxena
You could also try http://docraptor.com. It works on a freemium model and is easy to use.
Josh Colter
Use an API like http://www.htm2pdf.co.uk/html-to-pdf-api - code samples in Ruby included.
Retze Faber
Try the http://www.web2pdfconvert.com/, which could convert the online webpage into PDF format and send to you via Email. What you need to do is just input the URL and click Convert.
Jasmin Jiang
I've found that proper usage of media queries for browser printing is the most effective. If you can't get the result you want: PDF Prawn is a good gem for rendering your data to PDF. I've tried a lot of pdf converters but they just tend to do a mediocre job. They also are a hassle. PDF has restrictions, so when I go to PDF I tend to rethink and ask 'what do these people really want to see in print'? People looking to print are typically looking for something very specific. Typically custom reports or charts will end up a better and efficient way to meet requirements.
Joshua White
If you want to use existing PDF as template, defining areas (bounds, name, type, ...) to be filled later (e.g. with values from Web form), you can use Dhek template editor. Created template is saved in open format (JSON), so it can be processed in any language (PHP, Python, Ruby, Java, .Net): https://github.com/applicius/dhek .
Applicius FR
Related Q & A:
- How do I convert a PDF file to PDF/A in Delphi?Best solution by softwarerecs.stackexchange.com
- In Visual Studio 2012 or 2013, how can I register a DLL file on Windows 7 64-bit computer using a Custom Action command?Best solution by Stack Overflow
- How do I open a pdf file in my e'mail attachment?Best solution by Yahoo! Answers
- How do you shrink a PDF file?Best solution by Yahoo! Answers
- How do I open a pdf on an email?Best solution by ehow.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.