Need to create a button which will download the PDF file of report column row wise in polymerJS page

628 views Asked by At

I want to create a Button in a polymerJS page, after clicking that button It should download the PDF with decorations (In table format, with rows and columns).

Please Let me know what should I do.

Thanks in Advance.

1

There are 1 answers

1
j12y On BEST ANSWER

It seems there may be a few parts to your question which you could investigate separately:

  1. How to generate a polymer button
  2. How to trigger a download event
  3. How to create a PDF file with a table in a similar style to what is on your page
  4. How to serve the PDF

To generate a polymer button specifically for Predix you can check out the Predix UI button documentation.

To serve a PDF file -- you probably want a service that can set the correct MIME types and either dynamically generate the file or dynamically locate and serve the correct static file on disk. The specifics depend largely on your server-side language preferences, so for example in PHP: How to make PDF file downloadable in HTML link?

To generate the PDF is also language independent, but you may find the answer to this question helpful if you are working with node.js on the server-side: Generate pdf from HTML in div using Javascript

As an alternative approach, you may also consider allowing a user to print the page which could be saved as a PDF instead: link to Print in a webpage