File tree Expand file tree Collapse file tree
examples/pdf with header and footer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ "Last name" ;"First name";"SSN";"Test1";"Test2";"Test3";"Test4";"Final";"Grade"
2+ "Alfalfa";"Aloysius";"123-45-6789";40.0;90.0;100.0;83.0;49.0;"D-"
3+ "Alfred";"University";"123-12-1234";41.0;97.0;96.0;97.0;48.0;"D+"
4+ "Gerty";"Gramma";"567-89-0123";41.0;80.0;60.0;40.0;44.0;"C"
5+ "Android";"Electric";"087-65-4321";42.0;23.0;36.0;45.0;47.0;"B-"
6+ "Bumpkin";"Fred";"456-78-9012";43.0;78.0;88.0;77.0;45.0;"A-"
7+ "Rubble";"Betty";"234-56-7890";44.0;90.0;80.0;90.0;46.0;"C-"
8+ "Noshow";"Cecil";"345-67-8901";45.0;11.0;-1.0;4.0;43.0;"F"
9+ "Buff";"Bif";"632-79-9939";46.0;20.0;30.0;40.0;50.0;"B+"
10+ "Airpump";"Andrew";"223-45-6789";49.0;1.0;90.0;100.0;83.0;"A"
11+ "Backus";"Jim";"143-12-1234";48.0;1.0;97.0;96.0;97.0;"A+"
12+ "Carnivore";"Art";"565-89-0123";44.0;1.0;80.0;60.0;40.0;"D+"
13+ "Dandy";"Jim";"087-75-4321";47.0;1.0;23.0;36.0;45.0;"C+"
14+ "Elephant";"Ima";"456-71-9012";45.0;1.0;78.0;88.0;77.0;"B-"
15+ "Franklin";"Benny";"234-56-2890";50.0;1.0;90.0;80.0;90.0;"B-"
16+ "George";"Boy";"345-67-3901";40.0;1.0;11.0;-1.0;4.0;"B"
17+ "Heffalump";"Harvey";"632-79-9439";30.0;1.0;20.0;30.0;40.0;"C"
Original file line number Diff line number Diff line change 1+ del *.pdf
2+ java -jar ..\..\target\csv2pdf.jar -csv_file grades.csv -ftl_file template.ftl -pdf example.pdf
Original file line number Diff line number Diff line change 1+ <html >
2+ <head >
3+ <style >
4+
5+ @page {
6+
7+ @bottom-left {
8+ content : element (footer );
9+ vertical-align : top ;
10+ }
11+
12+ @top-right {
13+ content : element(header );
14+ vertical-align : bottom;
15+ }
16+
17+ size: A4 portrait;
18+ margin-top :3cm;
19+ margin-left :1.5cm;
20+ margin-right :1.5cm;
21+ margin-bottom :3cm;
22+ }
23+
24+ div .header {
25+ display : block ;
26+ position : running (header);
27+ border-bottom : 1px solid black ;
28+ }
29+
30+ div .footer {
31+ display : block ;
32+ position : running (footer);
33+ height : 3cm ;
34+ border-top : 1px solid black ;
35+ }
36+
37+ div .content {
38+ display : block ;
39+ text-align : justify ;
40+ }
41+
42+ div .newpage {
43+ page-break-after :always ;
44+ }
45+
46+ #pagenumber :before {
47+ content : counter (page );
48+ }
49+
50+ #pagecount :before {
51+ content : counter (pages );
52+ }
53+
54+ </style >
55+ </head >
56+ <body >
57+
58+ <div class="header">
59+ <p > This is the header that will repeat on every page at top</p >
60+ </div >
61+
62+ <div class="footer" >
63+ <p > This is the footer that will repeat on every page at bottom</p >
64+ <p > Page <span id="pagenumber"> </span > of <span id="pagecount"> </span > </p >
65+ </div >
66+
67+ <div class="content">
68+ <#list rows as row>
69+ <table style="text-align :center;margin:auto;font-size :1cm;padding-top :4cm;">
70+ <tr > <td colspan=2> ${row ["SSN "]}</td > </tr >
71+ <tr > <td > ${row ["Last name "]}</td > <td rowspan="2"> ${row ["Grade "]}</td > </tr >
72+ <tr > <td > ${row ["First name "]}</td > </tr >
73+ </table >
74+ <table style="text-align :center;margin:auto;font-size :0.5cm;padding-top :2cm;">
75+ <tr > <th > Test1</th > <th > Test2</th > <th > Test3</th > <th > Test4</th > <th > Final</th > </tr >
76+ <tr > <td > ${row .Test 1}</td > <td > ${row .Test 2}</td > <td > ${row .Test 3}</td > <td > ${row .Test 4}</td > <td > ${row .Final }</td > </tr >
77+ </table >
78+ <#sep > <div class="newpage"/> </#sep >
79+ </#list >
80+ </div >
81+
82+ </body >
83+ </html >
You can’t perform that action at this time.
0 commit comments