How can I export table data in pdf format in perspective?

I currently have my data in html format while it gets dowloaded.But how can I get it in PDF format while downloading it.
Here is my code to download the table data in html format.
table = self.parent.parent.getChild(Table).props.data
excelstr = system.dataset.dataSetToExcel(True,[table])
excelbytes = system.dataset.dataSetToHTML(1, table, "")
fileName = aaa.html
system.perspective.download(fileName, excelbytes)

Welcome to the forum.

Please see Wiki - how to post code on this forum. It's particularly important for Python scripts to preserve indentation. There's a pencil icon link under your post so you can edit to fix it.

That's what the Reporting module does. There's no other supported way to make PDFs.

Got it.Thanks for your response @pturmel