I am working on a Rails project and I need to convert the HTML page to a PDF page but it's writing HTML as it is on a pdf page. PDF page is not showing like a webpage. How can I generate a proper PDF from an HTML file?
Prawn::Document.generate("test.pdf") do
filepath = ${filepath}"file.html"
data = File.read(filepath);
text data
end
prawnis not really an HTML to PDF generator - see https://github.com/prawnpdf/prawn#should-you-use-prawnYou'll need to use another tool, for example
wicked_pdf- see https://github.com/mileszs/wicked_pdf#super-advanced-usageIn your case, to quote from the
README, you'll need something like