nameStyle.setPdfEncoding("Cp1252");
nameStyle.setPdfEmbedded(false);
jasperPrint.addStyle(nameStyle);
try {
Person person = (Person) system.query(new GetPerson(registration.getIdPerson()));
String genderChar = (person.getGender().equals("Masculino")?"o":"a");
if(isSimpleCertifyd){
JRPrintPage page = new JRBasePrintPage();
JRPrintText text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
text.setText("Certificamos que "+genderChar+" alun"+genderChar);
text.setX(convert(20));
text.setY(convert(65) + 10);
text.setWidth(730);
text.setHeight(27);
text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER);
text.setLineSpacingFactor(2.0f);
text.setLeadingOffset(-4.0f);
text.setStyle(bodyStyle);
page.addElement(text);
text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
text.setText(person.getName());
text.setX(convert(20));
text.setY(convert(65) + 43);
text.setWidth(730);
text.setHeight(53);
text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER);
text.setLineSpacingFactor(2.0f);
text.setLeadingOffset(-4.0f);
text.setStyle(nameStyle);
page.addElement(text);
text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
text.setText("concluiu o programa de cursos OPERADOR DE COMPUTADOR e est� apto para ocupar e exercer atividades relacionadas aos treinamentos descritos abaixo:");
text.setX(convert(20));
text.setY(convert(65) + 120);
text.setWidth(730);
text.setHeight(65);
text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER);
text.setLineSpacingFactor(2.0f);
text.setLeadingOffset(-4.0f);
text.setStyle(bodyStyle);
page.addElement(text);
String listCourses = "";
for (int i = 0; i < courses.size(); i++) {
system.execute(new SetCourseAsPrinted(registration, courses.get(i)));
listCourses += courses.get(i);
if(i != courses.size() - 1) {
listCourses += ", ";
}
}
text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
text.setText(listCourses);
text.setX(convert(20));
text.setY(convert(65) + 210);
text.setWidth(730);
text.setHeight(75);
text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER);
text.setLineSpacingFactor(2.0f);
text.setLeadingOffset(-4.0f);
text.setStyle(boldStyle);
page.addElement(text);
jasperPrint.addPage(page);
}
else {
JRPrintPage page = new JRBasePrintPage();
JRPrintText text = new JRBasePrintText(jasperPrint.getDefaultStyleProvider());
text.setText(person.getName());
text.setX(convert(20));
text.setY(convert(45) + 6);
text.setWidth(730);
text.setHeight(53);
text.setHorizontalAlignment(JRAlignment.HORIZONTAL_ALIGN_CENTER);