root / hci / trunk / eneraptor-web-app / grails-app / views / pdf / demo2.gsp @ 50
History | View | Annotate | Download (2.4 KB)
1 |
<html> |
---|---|
2 |
<head> |
3 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
4 |
<title>Simple PDF demo2</title> |
5 |
<style> |
6 |
.sample_table { |
7 |
width:60%; |
8 |
background-color:#b2b2b2; |
9 |
} |
10 |
.sample_table th { |
11 |
text-align:center; |
12 |
text-decoration:underline; |
13 |
} |
14 |
.sample_table td { |
15 |
padding:7px; |
16 |
background-color: #fff; |
17 |
} |
18 |
.small_text { |
19 |
font-size:8pt; |
20 |
} |
21 |
</style> |
22 |
</head> |
23 |
<body> |
24 |
<h1>Sample PDF Output</h1> |
25 |
<h2>This is simple HTML</h2> |
26 |
<h2 style='color:red'>this has inline CSS</h2> |
27 |
|
28 |
<h3>Here is some data passed from the contorller...</h3> |
29 |
<p>Information gathered from the controller: ${randomString}</p> |
30 |
|
31 |
<h3>Here is some information sent in the URL and handled by a controller (get variables):</h3> |
32 |
<table class="sample_table"> |
33 |
<thead> |
34 |
<tr> |
35 |
<th>ID</th> |
36 |
<th>Name</th> |
37 |
<th>Age</th> |
38 |
</tr> |
39 |
</thead> |
40 |
<tbody> |
41 |
<tr> |
42 |
<td>${id}</td> |
43 |
<td>${name}</td> |
44 |
<td>${age}</td> |
45 |
</tr> |
46 |
<tr> |
47 |
<td colspan="3" class="small_text">styled with css...</td> |
48 |
</tr> |
49 |
</tbody> |
50 |
</table> |
51 |
<img src="<g:resource dir='images' file='laptop.jpg' />" alt="laptop" title="laptop" /> |
52 |
|
53 |
<form> |
54 |
<p>checkbox: |
55 |
%{-- checkboxes used to cause an error in pdf generation, but now they simply don't show up... --}% |
56 |
<input type="checkbox" checked="checked" name="sample_box" title="sample_box" /> |
57 |
</p> |
58 |
%{-- text field sample --}% |
59 |
<p>Text Input: |
60 |
<input name="textField" /> |
61 |
</p> |
62 |
</form> |
63 |
|
64 |
|
65 |
<p>Images with relative URL's are automatically resolved by the the modified version of XHTMLrenderer included with the plugin</p> |
66 |
<img src="<g:resource dir='images' file='laptop.jpg' />" alt="laptop" title="laptop" /> |
67 |
|
68 |
<p>Images with absolute URI's also do just fine:</p> |
69 |
<img src="http://system76.com/images/nb1_front_med.jpg" alt="laptop2" title="laptop2" /> |
70 |
|
71 |
<p><strong>Hint:</strong> One way to style gsp's that you intend to make into pdf's is to have two seperate style sheets one for media="print" and one for media="screen". The print style sheet will be used to style the PDF, and if PDF generation fails you will get a styled HTML view that isn't all weird because of fonts sized in pt and such.</p> |
72 |
</body> |
73 |
</html> |