0

I'm using AngularJS to get data from API and populate HTML table using ng-repeat.

Table is populated from array containing JSON arrays with data (eg. vm.data = [{"x": 1, "y":2}, {"x": 1, "y":2}...])

HTML table is customized using external stylesheet file.

I want to create PDF file from that HTML table and possible div containing data about that table (like header). Preferably I would like this done without jQuery, only using pure JS and AngularJS. Also table in PDF should include stylesheet info (font, font-size, color, even child background...).

One thing to notice that table have limited height, but it is scrollable on X axis (using overflow:auto). I want table shown in PDF file to be full height.


Methods I tried:

jsPDF - not customizable for tables
html-pfg (https://www.npmjs.com/package/html-pdf) - not customizable for tables/bad documentation
(Is there an Angular way of printing a div from a HTML page?) - Hackish/Uses jQuery
(Print a div using javascript in angularJS single page application) - Not applying CSS files
(https://github.com/sayanee/angularjs-pdf) - This is not plugin for creating pdf documents...
pdfMake
(Generate PDF from HTML using pdfMake in Angularjs) - This is not working because only part of table is shown on page and it is scrollable. I want full table in my PDF.

Community
  • 1
  • 1

1 Answers1

0

I managed to create PDF reports that I needed.

Plugin I used is PDFmake and is definitely best I found, works so flawless.

Only problem I had is that I wrongly included it and that's why it didn't worked first time.