use of com.lowagie.text.HeaderFooter in project OpenClinica by OpenClinica.
the class DownloadDiscrepancyNote method serializeThreadsToPDF.
public void serializeThreadsToPDF(List<DiscrepancyNoteThread> listOfThreads, OutputStream stream, String studyIdentifier) {
ServletOutputStream servletStream = (ServletOutputStream) stream;
Document pdfDoc = new Document();
try {
PdfWriter.getInstance(pdfDoc, servletStream);
pdfDoc.open();
// Create header for the study identifier or name
if (studyIdentifier != null) {
HeaderFooter header = new HeaderFooter(new Phrase("Study Identifier: " + studyIdentifier + " pg."), true);
header.setAlignment(Element.ALIGN_CENTER);
Paragraph para = new Paragraph("Study Identifier: " + studyIdentifier, new Font(Font.HELVETICA, 18, Font.BOLD, new Color(0, 0, 0)));
para.setAlignment(Element.ALIGN_CENTER);
pdfDoc.setHeader(header);
pdfDoc.add(para);
}
for (DiscrepancyNoteThread discNoteThread : listOfThreads) {
pdfDoc.add(this.createTableThreadHeader(discNoteThread));
// Just the parent of the thread? discNoteThread.getLinkedNoteList()
for (DiscrepancyNoteBean discNoteBean : discNoteThread.getLinkedNoteList()) {
// DiscrepancyNoteBean discNoteBean = discNoteThread.getLinkedNoteList().getFirst();
if (discNoteBean.getParentDnId() > 0) {
pdfDoc.add(this.createTableFromBean(discNoteBean));
pdfDoc.add(new Paragraph("\n"));
}
}
}
// pdfDoc.add(new Paragraph(content));
} catch (DocumentException e) {
e.printStackTrace();
}
pdfDoc.close();
}
use of com.lowagie.text.HeaderFooter in project OpenClinica by OpenClinica.
the class DownloadDiscrepancyNote method serializeListToPDF.
public void serializeListToPDF(List<DiscrepancyNoteBean> listOfBeans, OutputStream stream, String studyIdentifier) {
ServletOutputStream servletStream = (ServletOutputStream) stream;
Document pdfDoc = new Document();
try {
PdfWriter.getInstance(pdfDoc, servletStream);
pdfDoc.open();
// Create header for the study identifier or name
if (studyIdentifier != null) {
HeaderFooter header = new HeaderFooter(new Phrase("Study Identifier: " + studyIdentifier + " pg."), true);
header.setAlignment(Element.ALIGN_CENTER);
Paragraph para = new Paragraph("Study Identifier: " + studyIdentifier, new Font(Font.HELVETICA, 18, Font.BOLD, new Color(0, 0, 0)));
para.setAlignment(Element.ALIGN_CENTER);
pdfDoc.setHeader(header);
pdfDoc.add(para);
}
for (DiscrepancyNoteBean discNoteBean : listOfBeans) {
pdfDoc.add(this.createTableFromBean(discNoteBean));
pdfDoc.add(new Paragraph("\n"));
}
// pdfDoc.add(new Paragraph(content));
} catch (DocumentException e) {
e.printStackTrace();
}
pdfDoc.close();
}
Aggregations