View Javadoc

1   package org.kuali.ole.deliver.batch;
2   
3   import com.lowagie.text.*;
4   import com.lowagie.text.Font;
5   import com.lowagie.text.pdf.PdfPCell;
6   import com.lowagie.text.pdf.PdfPTable;
7   import com.lowagie.text.pdf.PdfWriter;
8   import org.kuali.ole.OLEConstants;
9   import org.kuali.ole.PropertyUtil;
10  
11  import javax.servlet.ServletOutputStream;
12  import javax.servlet.http.HttpServletResponse;
13  import java.awt.*;
14  import java.awt.List;
15  import java.io.ByteArrayOutputStream;
16  import java.io.FileOutputStream;
17  import java.io.OutputStream;
18  import java.util.Date;
19  
20  /**
21   * Created with IntelliJ IDEA.
22   * User: ?
23   * Date: 11/23/12
24   * Time: 5:24 PM
25   * To change this template use File | Settings | File Templates.
26   */
27  public class OleDeliverNoticeService {
28  
29      public boolean createPdf(OleNoticeBo noticeBo){
30          boolean result = false;
31          OutputStream outputStream = null;
32          String fileName = noticeBo.getNoticeName()+"/"+noticeBo.getItemId();
33          String directory = PropertyUtil.getPropertyUtil().getProperty("ole.batch.email.notices");
34          try{
35              Document document = new Document(PageSize.A4);
36              outputStream = new FileOutputStream(directory+"/"+fileName+".pdf");
37              PdfWriter writer = PdfWriter.getInstance(document, outputStream);
38              Font boldFont = new Font(Font.TIMES_ROMAN, 15, Font.BOLD);
39              Font ver_15_normal = FontFactory.getFont("VERDANA", 15, 0);
40              document.open();
41              document.newPage();
42  
43              //document.setHeader(new HeaderFooter(new Phrase(fileName), new Phrase("Footer")));
44  
45              //Circulation Desk
46              Paragraph paraGraph = new Paragraph();
47              paraGraph.add(new Chunk(noticeBo.getNoticeName(),boldFont));
48              paraGraph.add(Chunk.NEWLINE);
49              document.add(paraGraph);
50              PdfPTable pdfTable =new PdfPTable(3);
51              PdfPCell pdfPCell = new PdfPCell(new Paragraph("Circulation Location / Library Name"));
52              pdfPCell.setBorder(pdfPCell.NO_BORDER);
53              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
54              pdfTable.addCell(pdfPCell);
55              pdfPCell = new PdfPCell(new Paragraph(":"));
56              pdfPCell.setBorder(pdfPCell.NO_BORDER);
57              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
58              pdfTable.addCell(pdfPCell);
59              pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getCirculationDeskName())));
60              pdfPCell.setBorder(pdfPCell.NO_BORDER);
61              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
62              pdfTable.addCell(pdfPCell);
63              pdfPCell = new PdfPCell(new Paragraph(new Chunk("Address")));
64              pdfPCell.setBorder(pdfPCell.NO_BORDER);
65              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
66              pdfTable.addCell(pdfPCell);
67              pdfPCell = new PdfPCell(new Paragraph(":"));
68              pdfPCell.setBorder(pdfPCell.NO_BORDER);
69              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
70              pdfTable.addCell(pdfPCell);
71              pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getCirculationDeskAddress())));
72              pdfPCell.setBorder(pdfPCell.NO_BORDER);
73              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
74              pdfTable.addCell(pdfPCell);
75              pdfPCell = new PdfPCell(new Paragraph(new Chunk("Email")));
76              pdfPCell.setBorder(pdfPCell.NO_BORDER);
77              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
78              pdfTable.addCell(pdfPCell);
79              pdfPCell = new PdfPCell(new Paragraph(":"));
80              pdfPCell.setBorder(pdfPCell.NO_BORDER);
81              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
82              pdfTable.addCell(pdfPCell);
83              pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getCirculationDeskEmailAddress())));
84              pdfPCell.setBorder(pdfPCell.NO_BORDER);
85              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
86              pdfTable.addCell(pdfPCell);
87              pdfPCell = new PdfPCell(new Paragraph(new Chunk("Phone #")));
88              pdfPCell.setBorder(pdfPCell.NO_BORDER);
89              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
90              pdfTable.addCell(pdfPCell);
91              pdfPCell = new PdfPCell(new Paragraph(":"));
92              pdfPCell.setBorder(pdfPCell.NO_BORDER);
93              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
94              pdfTable.addCell(pdfPCell);
95              pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getCirculationDeskPhoneNumber())));
96              pdfPCell.setBorder(pdfPCell.NO_BORDER);
97              pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
98              pdfTable.addCell(pdfPCell);
99              document.add(pdfTable);
100             paraGraph = new Paragraph();
101             paraGraph.add(Chunk.NEWLINE);
102             document.add(paraGraph);
103 
104             //Patron
105             paraGraph = new Paragraph();
106             paraGraph.add(new Chunk("Addressee",boldFont));
107             paraGraph.add(Chunk.NEWLINE);
108             document.add(paraGraph);
109             pdfTable =new PdfPTable(3);
110             pdfPCell = new PdfPCell(new Paragraph("Borrower Name"));
111             pdfPCell.setBorder(pdfPCell.NO_BORDER);
112             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
113             pdfTable.addCell(pdfPCell);
114             pdfPCell = new PdfPCell(new Paragraph(":"));
115             pdfPCell.setBorder(pdfPCell.NO_BORDER);
116             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
117             pdfTable.addCell(pdfPCell);
118             pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getPatronName()==null?"":noticeBo.getPatronName())));
119             pdfPCell.setBorder(pdfPCell.NO_BORDER);
120             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
121             pdfTable.addCell(pdfPCell);
122             pdfPCell = new PdfPCell(new Paragraph(new Chunk("Address")));
123             pdfPCell.setBorder(pdfPCell.NO_BORDER);
124             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
125             pdfTable.addCell(pdfPCell);
126             pdfPCell = new PdfPCell(new Paragraph(":"));
127             pdfPCell.setBorder(pdfPCell.NO_BORDER);
128             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
129             pdfTable.addCell(pdfPCell);
130             pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getPatronAddress()==null?"":noticeBo.getPatronAddress())));
131             pdfPCell.setBorder(pdfPCell.NO_BORDER);
132             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
133             pdfTable.addCell(pdfPCell);
134             pdfPCell = new PdfPCell(new Paragraph(new Chunk("Email")));
135             pdfPCell.setBorder(pdfPCell.NO_BORDER);
136             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
137             pdfTable.addCell(pdfPCell);
138             pdfPCell = new PdfPCell(new Paragraph(":"));
139             pdfPCell.setBorder(pdfPCell.NO_BORDER);
140             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
141             pdfTable.addCell(pdfPCell);
142             pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getPatronEmailAddress()==null?"":noticeBo.getPatronEmailAddress())));
143             pdfPCell.setBorder(pdfPCell.NO_BORDER);
144             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
145             pdfTable.addCell(pdfPCell);
146             pdfPCell = new PdfPCell(new Paragraph(new Chunk("Phone #")));
147             pdfPCell.setBorder(pdfPCell.NO_BORDER);
148             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
149             pdfTable.addCell(pdfPCell);
150             pdfPCell = new PdfPCell(new Paragraph(":"));
151             pdfPCell.setBorder(pdfPCell.NO_BORDER);
152             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
153             pdfTable.addCell(pdfPCell);
154             pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getPatronPhoneNumber()==null?"":noticeBo.getPatronPhoneNumber())));
155             pdfPCell.setBorder(pdfPCell.NO_BORDER);
156             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
157             pdfTable.addCell(pdfPCell);
158             document.add(pdfTable);
159             paraGraph = new Paragraph();
160             paraGraph.add(Chunk.NEWLINE);
161             document.add(paraGraph);
162 
163             //Notice Type
164             paraGraph = new Paragraph();
165             paraGraph.add(new Chunk(noticeBo.getNoticeName(),boldFont));
166             paraGraph.setAlignment(Element.ALIGN_CENTER);
167             paraGraph.add(Chunk.NEWLINE);
168             document.add(paraGraph);
169 
170 
171             //Notice-specific text
172             paraGraph = new Paragraph();
173             paraGraph.add(new Chunk(noticeBo.getNoticeSpecificContent(),boldFont));
174             paraGraph.setAlignment(Element.ALIGN_CENTER);
175             paraGraph.add(Chunk.NEWLINE);
176             document.add(paraGraph);
177             //Title/item information
178             paraGraph = new Paragraph();
179             paraGraph.add(new Chunk("Title/item information",boldFont));
180             paraGraph.add(Chunk.NEWLINE);
181             document.add(paraGraph);
182             pdfTable =new PdfPTable(3);
183             pdfPCell = new PdfPCell(new Paragraph("Title "));
184             pdfPCell.setBorder(pdfPCell.NO_BORDER);
185             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
186             pdfTable.addCell(pdfPCell);
187             pdfPCell = new PdfPCell(new Paragraph(":"));
188             pdfPCell.setBorder(pdfPCell.NO_BORDER);
189             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
190             pdfTable.addCell(pdfPCell);
191             pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getTitle()==null?"":noticeBo.getTitle())));
192             pdfPCell.setBorder(pdfPCell.NO_BORDER);
193             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
194             pdfTable.addCell(pdfPCell);
195             pdfPCell = new PdfPCell(new Paragraph(new Chunk("Author ")));
196             pdfPCell.setBorder(pdfPCell.NO_BORDER);
197             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
198             pdfTable.addCell(pdfPCell);
199             pdfPCell = new PdfPCell(new Paragraph(":"));
200             pdfPCell.setBorder(pdfPCell.NO_BORDER);
201             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
202             pdfTable.addCell(pdfPCell);
203             pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getAuthor()==null?"":noticeBo.getAuthor())));
204             pdfPCell.setBorder(pdfPCell.NO_BORDER);
205             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
206             pdfTable.addCell(pdfPCell);
207             pdfPCell = new PdfPCell(new Paragraph(new Chunk("Volume/Issue/Copy # ")));
208             pdfPCell.setBorder(pdfPCell.NO_BORDER);
209             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
210             pdfTable.addCell(pdfPCell);
211             pdfPCell = new PdfPCell(new Paragraph(":"));
212             pdfPCell.setBorder(pdfPCell.NO_BORDER);
213             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
214             pdfTable.addCell(pdfPCell);
215             pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getVolumeNumber()==null?"":noticeBo.getVolumeNumber())));
216             pdfPCell.setBorder(pdfPCell.NO_BORDER);
217             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
218             pdfTable.addCell(pdfPCell);
219             pdfPCell = new PdfPCell(new Paragraph(new Chunk("Library shelving location ")));
220             pdfPCell.setBorder(pdfPCell.NO_BORDER);
221             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
222             pdfTable.addCell(pdfPCell);
223             pdfPCell = new PdfPCell(new Paragraph(":"));
224             pdfPCell.setBorder(pdfPCell.NO_BORDER);
225             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
226             pdfTable.addCell(pdfPCell);
227             pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getItemShelvingLocation()==null?"":noticeBo.getItemShelvingLocation())));
228             pdfPCell.setBorder(pdfPCell.NO_BORDER);
229             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
230             pdfTable.addCell(pdfPCell);
231             pdfPCell = new PdfPCell(new Paragraph(new Chunk("Call # ")));
232             pdfPCell.setBorder(pdfPCell.NO_BORDER);
233             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
234             pdfTable.addCell(pdfPCell);
235             pdfPCell = new PdfPCell(new Paragraph(":"));
236             pdfPCell.setBorder(pdfPCell.NO_BORDER);
237             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
238             pdfTable.addCell(pdfPCell);
239             pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getItemCallNumber()==null?"":noticeBo.getItemCallNumber())));
240             pdfPCell.setBorder(pdfPCell.NO_BORDER);
241             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
242             pdfTable.addCell(pdfPCell);
243             pdfPCell = new PdfPCell(new Paragraph(new Chunk("Item barcode")));
244             pdfPCell.setBorder(pdfPCell.NO_BORDER);
245             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
246             pdfTable.addCell(pdfPCell);
247             pdfPCell = new PdfPCell(new Paragraph(":"));
248             pdfPCell.setBorder(pdfPCell.NO_BORDER);
249             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
250             pdfTable.addCell(pdfPCell);
251             pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getItemId()==null?"":noticeBo.getItemId())));
252             pdfPCell.setBorder(pdfPCell.NO_BORDER);
253             pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
254             pdfTable.addCell(pdfPCell);
255             document.add(pdfTable);
256             paraGraph = new Paragraph();
257             paraGraph.add(Chunk.NEWLINE);
258             document.add(paraGraph);
259 
260             //Information specific text
261   /*          paraGraph = new Paragraph();
262             paraGraph.add(new Chunk("Information specific text",boldFont));
263             paraGraph.add(Chunk.NEWLINE);
264             document.add(paraGraph);*/
265             if(noticeBo.getNoticeName().equals("Recall Notice")){
266                 pdfTable =new PdfPTable(3);
267                 pdfPCell = new PdfPCell(new Paragraph("Original Due Date"));
268                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
269                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
270                 pdfTable.addCell(pdfPCell);
271                 pdfPCell = new PdfPCell(new Paragraph(":"));
272                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
273                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
274                 pdfTable.addCell(pdfPCell);
275                 pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getOriginalDueDate()== null ? "":noticeBo.getOriginalDueDate().toString())));
276                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
277                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
278                 pdfTable.addCell(pdfPCell);
279                 pdfPCell = new PdfPCell(new Paragraph(new Chunk("New Due Date")));
280                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
281                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
282                 pdfTable.addCell(pdfPCell);
283                 pdfPCell = new PdfPCell(new Paragraph(":"));
284                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
285                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
286                 pdfTable.addCell(pdfPCell);
287                 pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getNewDueDate()== null ? "":noticeBo.getNewDueDate().toString())));
288                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
289                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
290                 pdfTable.addCell(pdfPCell);
291                 document.add(pdfTable);
292                 paraGraph = new Paragraph();
293                 paraGraph.add(Chunk.NEWLINE);
294                 document.add(paraGraph);
295             }  else if(noticeBo.getNoticeName().equals("Hold Notice")){
296                 pdfTable =new PdfPTable(3);
297                 pdfPCell = new PdfPCell(new Paragraph("Pick Up Location"));
298                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
299                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
300                 pdfTable.addCell(pdfPCell);
301                 pdfPCell = new PdfPCell(new Paragraph(":"));
302                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
303                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
304                 pdfTable.addCell(pdfPCell);
305                 pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getPickUpLocation())));
306                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
307                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
308                 pdfTable.addCell(pdfPCell);
309                 pdfPCell = new PdfPCell(new Paragraph("Circulation Location / Library Name"));
310                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
311                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
312                 pdfTable.addCell(pdfPCell);
313                 pdfPCell = new PdfPCell(new Paragraph(":"));
314                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
315                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
316                 pdfTable.addCell(pdfPCell);
317                 pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getCirculationDeskName())));
318                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
319                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
320                 pdfTable.addCell(pdfPCell);
321                 pdfPCell = new PdfPCell(new Paragraph(new Chunk("Address")));
322                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
323                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
324                 pdfTable.addCell(pdfPCell);
325                 pdfPCell = new PdfPCell(new Paragraph(":"));
326                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
327                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
328                 pdfTable.addCell(pdfPCell);
329                 pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getCirculationDeskAddress())));
330                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
331                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
332                 pdfTable.addCell(pdfPCell);
333                 pdfPCell = new PdfPCell(new Paragraph(new Chunk("Email")));
334                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
335                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
336                 pdfTable.addCell(pdfPCell);
337                 pdfPCell = new PdfPCell(new Paragraph(":"));
338                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
339                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
340                 pdfTable.addCell(pdfPCell);
341                 pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getCirculationDeskEmailAddress())));
342                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
343                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
344                 pdfTable.addCell(pdfPCell);
345                 pdfPCell = new PdfPCell(new Paragraph(new Chunk("Phone #")));
346                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
347                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
348                 pdfTable.addCell(pdfPCell);
349                 pdfPCell = new PdfPCell(new Paragraph(":"));
350                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
351                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
352                 pdfTable.addCell(pdfPCell);
353                 pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getCirculationDeskPhoneNumber())));
354                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
355                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
356                 pdfTable.addCell(pdfPCell);
357                 document.add(pdfTable);
358                 paraGraph = new Paragraph();
359                 paraGraph.add(Chunk.NEWLINE);
360                 document.add(paraGraph);
361                 pdfPCell = new PdfPCell(new Paragraph(new Chunk("Item Will Be Held until")));
362                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
363                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
364                 pdfTable.addCell(pdfPCell);
365                 pdfPCell = new PdfPCell(new Paragraph(":"));
366                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
367                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
368                 pdfTable.addCell(pdfPCell);
369                 pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getOnHoldDueDate().toString())));
370                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
371                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
372                 pdfTable.addCell(pdfPCell);
373                 document.add(pdfTable);
374                 paraGraph = new Paragraph();
375                 paraGraph.add(Chunk.NEWLINE);
376                 document.add(paraGraph);
377             } else  if(noticeBo.getNoticeName().equals("OverdueNotice")){
378                 pdfTable =new PdfPTable(3);
379                 pdfPCell = new PdfPCell(new Paragraph("Item was due"));
380                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
381                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
382                 pdfTable.addCell(pdfPCell);
383                 pdfPCell = new PdfPCell(new Paragraph(":"));
384                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
385                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_LEFT);
386                 pdfTable.addCell(pdfPCell);
387                 pdfPCell = new PdfPCell(new Paragraph(new Chunk(noticeBo.getDueDate()== null ? "":(noticeBo.getDueDate()))));
388                 pdfPCell.setBorder(pdfPCell.NO_BORDER);
389                 pdfPCell.setHorizontalAlignment(pdfPCell.ALIGN_JUSTIFIED);
390                 pdfTable.addCell(pdfPCell);
391                 document.add(pdfTable);
392                 paraGraph = new Paragraph();
393                 paraGraph.add(Chunk.NEWLINE);
394                 document.add(paraGraph);
395             }
396 
397             //My Account
398             /*    PdfContentByte cb = writer.getDirectContent();
399          cb.setLineWidth(1);
400          cb.moveTo(0, 245);
401          cb.lineTo(0 + document.getPageSize().width(), 245);
402          cb.stroke();
403          cb = writer.getDirectContent();
404          cb.setLineWidth(1);
405          cb.moveTo(0, 222);
406          cb.lineTo(0 + document.getPageSize().width(), 222);
407          cb.stroke();
408          paraGraph = new Paragraph();*/
409             /*paraGraph.add(new Chunk("My Account",boldFont));
410             paraGraph.add(Chunk.NEWLINE);*/
411             ver_15_normal.setColor(Color.blue);
412             ver_15_normal.setStyle(Font.UNDERLINE);
413             Anchor anchor = new Anchor("MyAccount", ver_15_normal);
414             anchor.setName("My Account");
415             String url = PropertyUtil.getPropertyUtil().getProperty("ole.rice2.url.base");
416             anchor.setReference(url+"/portal.do?channelTitle=MyAccount&channelUrl="+url+"/kr-krad/myaccountcontroller?viewId=RenewalItemView&methodToCall=start");
417             paraGraph.add(anchor);
418             paraGraph.setAlignment(Element.ALIGN_CENTER);
419             document.add(paraGraph);
420 
421 
422             outputStream.flush();
423             document.close();
424             outputStream.close();
425         }catch (Exception ex){
426 
427         }
428         return result;
429     }
430 }