hi,
I want to publish the page contents in pdf format. "
site.com/something.html" and "
site.com/something.pdf" for example.
I did some research about pisa. python code that generates pdf with pisa;
import ho.pisa as pisa
def helloWorld():
filename = "/srv/www/hello.pdf"
pdf = pisa.CreatePDF(
"Hello <strong>World</strong>",
file(filename, "wb"))
if not pdf.err:
pisa.startViewer(filename)
if __name__=="__main__":
pisa.showLogging()
helloWorld()
how can I do dynamic output it into the handler?
class PdfHandler(BaseHandler):
def get(self, slug):
import ho.pisa as pisa
self.set_header("Content-Type", "application/pdf")
...
...