root / hci / trunk / eneraptor-web-app / grails-app / views / pdf / demo.gsp @ 50
History | View | Annotate | Download (11.7 KB)
1 | 50 | alexbesir | <html> |
---|---|---|---|
2 | <head> |
||
3 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> |
||
4 | <meta name="layout" content="main" /> |
||
5 | <title>Simple PDF demo</title> |
||
6 | <style> |
||
7 | .code_table { |
||
8 | width:80%; |
||
9 | background-color:#b2b2b2; |
||
10 | } |
||
11 | .code_table tr {padding:2px;} |
||
12 | .code_table td { |
||
13 | padding:7px; |
||
14 | background-color: #fff; |
||
15 | } |
||
16 | </style> |
||
17 | </head> |
||
18 | <body> |
||
19 | <h1>Grails PDF Plugin demo page</h1> |
||
20 | |||
21 | <h2>Tag Documentation / Live Examples / Functional Testing</h2> |
||
22 | <h3>pdfLink tag:</h3> |
||
23 | |||
24 | <table class="code_table"> |
||
25 | <thead> |
||
26 | <tr> |
||
27 | <th>Description</th> |
||
28 | <th>Sample Source/HTML output</th> |
||
29 | <th>In Action</th> |
||
30 | </tr> |
||
31 | </thead> |
||
32 | <tbody> |
||
33 | <tr><td colspan="3"><em>URL method examples:</em></td></tr> |
||
34 | <tr> |
||
35 | <td rowspan="2" >Simple Usage:</td> |
||
36 | <td> |
||
37 | <code><g:pdfLink url="/pdf/demo2">PDF View</g:pdfLink></code> |
||
38 | </td> |
||
39 | <td rowspan="2"> |
||
40 | <g:pdfLink url="/pdf/demo2">PDF View</g:pdfLink> |
||
41 | </td> |
||
42 | </tr> |
||
43 | <tr> |
||
44 | <td> |
||
45 | <code> |
||
46 | <a class="pdf" title="pdf" href="/pdf/pdf/pdfLink?url=%2Fpdf%2Fdemo2"><br /> |
||
47 | PDF View <br /> |
||
48 | </a> |
||
49 | </code> |
||
50 | </td> |
||
51 | </tr> |
||
52 | <tr> |
||
53 | <td rowspan="2" >Simple Usage w/ Get data:</td> |
||
54 | <td> |
||
55 | <code><g:pdfLink url="/pdf/demo2/5?name=bob&age=22">PDF View</g:pdfLink></code> |
||
56 | </td> |
||
57 | <td rowspan="2"> |
||
58 | <g:pdfLink url="/pdf/demo2/5?name=bob&age=22">PDF View</g:pdfLink> |
||
59 | </td> |
||
60 | </tr> |
||
61 | <tr> |
||
62 | <td> |
||
63 | <code> |
||
64 | <a class="pdf" title="pdf" href="/pdf/pdf/pdfLink?url=%2Fpdf%2Fdemo2%2F5%3Fname%3Dbob%26age%3D22"><br /> |
||
65 | PDF View <br /> |
||
66 | </a> |
||
67 | </code> |
||
68 | </td> |
||
69 | </tr> |
||
70 | <tr> |
||
71 | <td rowspan="2" >Custom filename</td> |
||
72 | <td> |
||
73 | <code><g:pdfLink url="/pdf/demo2.gsp" filename="sample.pdf">sample.pdf</g:pdfLink></code> |
||
74 | </td> |
||
75 | <td rowspan="2" > |
||
76 | <g:pdfLink url="/pdf/demo2.gsp" filename="sample.pdf">sample.pdf</g:pdfLink> |
||
77 | </td> |
||
78 | </tr> |
||
79 | <tr> |
||
80 | <td> |
||
81 | <code> |
||
82 | <a class="pdf" title="pdf" href="/pdf/pdf/pdfLink?url=%2Fpdf%2Fdemo2.gsp&filename=sample.pdf"><br /> |
||
83 | sample.pdf<br /> |
||
84 | </a> |
||
85 | </code> |
||
86 | </td> |
||
87 | </tr> |
||
88 | <tr> |
||
89 | <td rowspan="2">Bundled icon</td> |
||
90 | <td> |
||
91 | <code><g:pdfLink url="/pdf/demo2.gsp" filename="sample.pdf" icon="true"/></code> |
||
92 | </td> |
||
93 | <td rowspan="2"> |
||
94 | <g:pdfLink url="/pdf/demo2.gsp" filename="sample.pdf" icon="true"/> |
||
95 | </td> |
||
96 | </tr> |
||
97 | <tr> |
||
98 | <td> |
||
99 | <code> |
||
100 | <a class="pdf" title="pdf" href="/pdf/pdf/pdfLink?url=%2Fpdf%2Fdemo2.gsp&filename=sample.pdf"> <br /> |
||
101 | <img border="0" alt="PDF Version" src="/pdf/images/pdf_button.png" /> <br /> |
||
102 | </a> |
||
103 | </code> |
||
104 | </td> |
||
105 | </tr> |
||
106 | <tr> |
||
107 | <td rowspan="2">Bundled icon w/ link content</td> |
||
108 | <td> |
||
109 | <code><g:pdfLink url="/pdf/demo2.gsp" filename="sample.pdf" icon="true" class="myPdfLink">Custom link</g:pdfLink></code> |
||
110 | </td> |
||
111 | <td rowspan="2"> |
||
112 | <g:pdfLink url="/pdf/demo2.gsp" filename="sample.pdf" icon="true" class="myPdfLink">Custom link</g:pdfLink> |
||
113 | </td> |
||
114 | </tr> |
||
115 | <tr> |
||
116 | <td> |
||
117 | <code> |
||
118 | <a class="myPdfLink" title="pdf" href="/pdf/pdf/pdfLink?url=%2Fpdf%2Fdemo2.gsp&filename=sample.pdf"> <br /> |
||
119 | <img border="0" alt="PDF Version" src="/pdf/images/pdf_button.png" /> <br /> |
||
120 | Custom link<br /> |
||
121 | </a> |
||
122 | </code> |
||
123 | </td> |
||
124 | </tr> |
||
125 | <tr><td colspan="3"><em>String method examples:</em></td></tr> |
||
126 | %{-- <tr> |
||
127 | <td rowspan="2" >Simple Template Usage:</td> |
||
128 | <td> |
||
129 | <code><g:pdfLink template="demo2">template as PDF</g:pdfLink></code> |
||
130 | </td> |
||
131 | <td rowspan="2"> |
||
132 | <g:pdfLink template="demo2">template as PDF</g:pdfLink> |
||
133 | </td> |
||
134 | </tr> |
||
135 | <tr> |
||
136 | <td> |
||
137 | <code> |
||
138 | <a class="pdf" title="pdf" href="/pdf/pdf/pdfLink?template=demo2&filename=document.pdf"><br /> |
||
139 | PDF View <br /> |
||
140 | </a> |
||
141 | </code> |
||
142 | </td> |
||
143 | </tr> --}% |
||
144 | <tr> |
||
145 | <td rowspan="2" >Simple Controller Action Usage (action and id are optional):</td> |
||
146 | <td> |
||
147 | <code><g:pdfLink pdfController="pdf" pdfAction="demo2">GSP as PDF</g:pdfLink></code> |
||
148 | </td> |
||
149 | <td rowspan="2"> |
||
150 | <g:pdfLink pdfController="pdf" pdfAction="demo2">GSP as PDF</g:pdfLink> |
||
151 | </td> |
||
152 | </tr> |
||
153 | <tr> |
||
154 | <td> |
||
155 | <code> |
||
156 | <a class="pdf" title="pdf" href="/pdf/pdf/pdfLink?&pdfController=pdf&pdfAction=demo2"><br /> |
||
157 | PDF View <br /> |
||
158 | </a> |
||
159 | </code> |
||
160 | </td> |
||
161 | </tr> |
||
162 | <tr> |
||
163 | <td rowspan="2" >Simple Controller Action + Id Usage:</td> |
||
164 | <td> |
||
165 | <code><g:pdfLink pdfController="pdf" pdfAction="demo2" pdfId="65432">GSP as PDF</g:pdfLink></code> |
||
166 | </td> |
||
167 | <td rowspan="2"> |
||
168 | <g:pdfLink pdfController="pdf" pdfAction="demo2" pdfId="65432">GSP as PDF</g:pdfLink> |
||
169 | </td> |
||
170 | </tr> |
||
171 | <tr> |
||
172 | <td> |
||
173 | <code> |
||
174 | <a class="pdf" title="pdf" href="/pdf/pdf/pdfLink?&pdfController=pdf&pdfAction=demo2&pdfId=65432"><br /> |
||
175 | PDF View <br /> |
||
176 | </a> |
||
177 | </code> |
||
178 | </td> |
||
179 | </tr> |
||
180 | </tbody> |
||
181 | </table> |
||
182 | |||
183 | <h3>pdfForm tag:</h3> |
||
184 | <table class="code_table"> |
||
185 | <thead> |
||
186 | <tr> |
||
187 | <th>Description</th> |
||
188 | <th>Sample Source/HTML output</th> |
||
189 | <th>In Action</th> |
||
190 | </tr> |
||
191 | </thead> |
||
192 | <tbody> |
||
193 | <tr><td colspan="3"><em>GET method examples:</em></td></tr> |
||
194 | <tr> |
||
195 | <td rowspan="2" >Simple Usage:</td> |
||
196 | <td> |
||
197 | <code><g:pdfForm url="/pdf/demo2">...</g:pdfForm></code> |
||
198 | </td> |
||
199 | <td rowspan="2"> |
||
200 | <g:pdfForm url="/pdf/demo2" > |
||
201 | name:<br /> |
||
202 | <g:textField name="name" size="10"/> |
||
203 | <g:submitButton name="printPdf" value="pdf" /> |
||
204 | </g:pdfForm> |
||
205 | </td> |
||
206 | </tr> |
||
207 | <tr> |
||
208 | <td> |
||
209 | <code> |
||
210 | <form id="simplePdfForm" method="get" action="/pdf/pdf/pdfForm" name="simplePdfForm"><br /> |
||
211 | <input type="hidden" value="/pdf/demo2" name="url"/><br /> |
||
212 | <input type="hidden" value="document.pdf" name="filename"/><br /> |
||
213 | ...<br /> |
||
214 | </form></code> |
||
215 | </td> |
||
216 | </tr> |
||
217 | <tr> |
||
218 | <td rowspan="2" >w/ Id and Filename:</td> |
||
219 | <td> |
||
220 | <code><g:pdfForm url="/pdf/demo2/1968" filename="sample.pdf">...</g:pdfForm></code> |
||
221 | </td> |
||
222 | <td rowspan="2"> |
||
223 | <g:pdfForm url="/pdf/demo2/1968" filename="sample.pdf"> |
||
224 | age:<br /> |
||
225 | <g:textField name="age" size="3"/> |
||
226 | <g:submitButton name="printPdf" value="pdf" /> |
||
227 | </g:pdfForm> |
||
228 | </td> |
||
229 | </tr> |
||
230 | <tr> |
||
231 | <td> |
||
232 | <code> |
||
233 | <form id="simplePdfForm" method="get" action="/pdf/pdf/pdfForm" name="simplePdfForm"><br /> |
||
234 | <input type="hidden" value="/pdf/demo2/1968" name="url"/><br /> |
||
235 | <input type="hidden" value="sample.pdf" name="filename"/><br /> |
||
236 | ...<br /> |
||
237 | </form> |
||
238 | </code> |
||
239 | </td> |
||
240 | </tr> |
||
241 | <tr><td colspan="3"><em>POST method examples:</em></td></tr> |
||
242 | <tr> |
||
243 | <td rowspan="2" >Controller and Action:</td> |
||
244 | <td> |
||
245 | <code><g:pdfForm controller="pdf" action="demo3" method="post">...</g:pdfForm></code> |
||
246 | </td> |
||
247 | <td rowspan="2"> |
||
248 | <g:pdfForm controller="pdf" action="demo3" method="post" > |
||
249 | food:<br /> |
||
250 | <g:textField name="food" size="10"/> |
||
251 | <g:submitButton name="printPdf" value="pdf" /> |
||
252 | </g:pdfForm> |
||
253 | </td> |
||
254 | </tr> |
||
255 | <tr> |
||
256 | <td> |
||
257 | <code> |
||
258 | <form id="simplePdfForm" method="post" action="/pdf/pdf/pdfForm" name="simplePdfForm"><br /> |
||
259 | <input type="hidden" value="pdf" name="pdfController"/><br /> |
||
260 | <input type="hidden" value="demo3" name="pdfAction"/><br /> |
||
261 | <input type="hidden" value="document.pdf" name="filename"/><br /> |
||
262 | ...<br /> |
||
263 | </form> |
||
264 | </code> |
||
265 | </td> |
||
266 | </tr> |
||
267 | <tr> |
||
268 | <td rowspan="2" >Controller, Action, Id and Filename:</td> |
||
269 | <td> |
||
270 | <code><g:pdfForm controller="pdf" action="demo3" method="post">...</g:pdfForm></code> |
||
271 | </td> |
||
272 | <td rowspan="2"> |
||
273 | <g:pdfForm controller="pdf" action="demo3" id="1942" method="post" filename="sample.pdf" > |
||
274 | food:<br /> |
||
275 | <g:textField name="food" size="10"/> |
||
276 | <g:submitButton name="printPdf" value="pdf" /> |
||
277 | </g:pdfForm> |
||
278 | </td> |
||
279 | </tr> |
||
280 | <tr> |
||
281 | <td> |
||
282 | <code> |
||
283 | <form id="simplePdfForm" method="post" action="/pdf/pdf/pdfForm" name="simplePdfForm"><br /> |
||
284 | <input type="hidden" value="pdf" name="pdfController"/><br /> |
||
285 | <input type="hidden" value="demo3" name="pdfAction"/><br /> |
||
286 | <input type="hidden" value="document.pdf" name="filename"/><br /> |
||
287 | ...<br /> |
||
288 | </form> |
||
289 | </code> |
||
290 | </td> |
||
291 | </tr> |
||
292 | <tr> |
||
293 | <td rowspan="2" >Template:</td> |
||
294 | <td> |
||
295 | <code><g:pdfForm template="demo2" >...</g:pdfForm></code> |
||
296 | </td> |
||
297 | <td rowspan="2"> |
||
298 | <g:pdfForm template="demo2" method="post"> |
||
299 | hometown:<br /> |
||
300 | <g:textField name="hometown" size="10"/> |
||
301 | <g:submitButton name="printPdf" value="pdf" /> |
||
302 | </g:pdfForm> |
||
303 | </td> |
||
304 | </tr> |
||
305 | <tr> |
||
306 | <td> |
||
307 | <code> |
||
308 | <form id="simplePdfForm" method="post" action="/pdf/pdf/pdfForm2" name="simplePdfForm"><br /> |
||
309 | <input type="hidden" value="demo2" name="template"/><br /> |
||
310 | ...<br /> |
||
311 | </form> |
||
312 | </code> |
||
313 | </td> |
||
314 | </tr> |
||
315 | <tr> |
||
316 | <td rowspan="2" >Template and Filename:</td> |
||
317 | <td> |
||
318 | <code><g:pdfForm template="demo2" filename="sample.pdf">...</g:pdfForm></code> |
||
319 | </td> |
||
320 | <td rowspan="2"> |
||
321 | <g:pdfForm template="demo2" filename="sample.pdf" method="post"> |
||
322 | hometown:<br /> |
||
323 | <g:textField name="hometown" size="10"/> |
||
324 | <g:submitButton name="printPdf" value="pdf" /> |
||
325 | </g:pdfForm> |
||
326 | </td> |
||
327 | </tr> |
||
328 | <tr> |
||
329 | <td> |
||
330 | <code> |
||
331 | <form id="simplePdfForm" method="post" action="/pdf/pdf/pdfForm2" name="simplePdfForm"><br /> |
||
332 | <input type="hidden" value="demo2" name="template"/><br /> |
||
333 | <input type="hidden" value="sample.pdf" name="filename"/><br /> |
||
334 | ...<br /> |
||
335 | </form> |
||
336 | </code> |
||
337 | </td> |
||
338 | </tr> |
||
339 | </tbody> |
||
340 | </table> |
||
341 | </body> |
||
342 | </html> |