List of usage examples for com.itextpdf.text Font NORMAL
int NORMAL
To view the source code for com.itextpdf.text Font NORMAL.
Click Source Link
From source file:sistema.audizio.relatorio.Relatorio.java
public void gerar(Cliente cliente, Processo processo, Veiculo veiculo, Cidade cidade, Bairro bairro, Assessoria assesoria)// w ww . j a va2 s . co m throws DocumentException, FileNotFoundException, BadElementException, IOException { String local = "c:\\sistema\\audisio\\relatorios\\" + cliente.getNome() + "-N P-" + processo.getProcesso() + ".pdf"; Document document = new Document(); //PdfWriter.getInstance(document, new FileOutputStream("C:\\Users\\ZipNet\\Desktop\\Pdf's\\teste.pdf")); PdfWriter.getInstance(document, new FileOutputStream(local)); document.open(); Font f = new Font(FontFamily.COURIER, 15, Font.NORMAL); Font fgrande = new Font(FontFamily.HELVETICA, 25, Font.ITALIC); Image img = Image.getInstance("c:/sistema/audisio/imagens/relatorio.png"); img.setAlignment(Element.ALIGN_LEFT); Paragraph titulo = new Paragraph("Relatrio de processo", fgrande); Paragraph Clienteente = new Paragraph("DADOS CLIENTE"); Paragraph Processocesso = new Paragraph("DADOS PROCESSO"); Paragraph veiculolo = new Paragraph("DADOS VE?CULO"); titulo.setAlignment(Paragraph.ALIGN_RIGHT); Clienteente.setAlignment(Paragraph.ALIGN_CENTER); Processocesso.setAlignment(Paragraph.ALIGN_CENTER); veiculolo.setAlignment(Paragraph.ALIGN_CENTER); document.add(img); document.add(titulo); document.add(new Paragraph(" ")); document.add(Clienteente); document.add( new Paragraph("______________________________________________________________________________")); document.add(new Paragraph("Nome..: " + cliente.getNome(), f)); document.add(new Paragraph("Celular..: " + cliente.getCelular(), f)); document.add(new Paragraph("Cep..: " + cliente.getCep(), f)); document.add(new Paragraph("Cpf..: " + cliente.getCpf(), f)); document.add(new Paragraph("Uf: " + cliente.getEstado(), f)); document.add(new Paragraph("Endereo..: " + cliente.getEndereco() + ", " + cliente.getNum() + ", " + bairro.getNome() + ", " + cidade.getNome(), f)); document.add(new Paragraph("E-mail..: " + cliente.getEmail(), f)); document.add(new Paragraph(" ")); document.add(veiculolo); document.add( new Paragraph("______________________________________________________________________________")); document.add(new Paragraph(" ")); document.add(new Paragraph("Marca..: " + veiculo.getMarca(), f)); document.add(new Paragraph("Modelo..: " + veiculo.getModelo(), f)); document.add(new Paragraph("Placa..: " + veiculo.getPlaca(), f)); document.add(new Paragraph("Estado..: " + veiculo.getEstado(), f)); document.add(new Paragraph(" ")); document.add(Processocesso); document.add( new Paragraph("______________________________________________________________________________")); document.add(new Paragraph(" ")); document.add(new Paragraph("Processo..: " + processo.getProcesso(), f)); document.add(new Paragraph("Data inicio..: " + processo.getData_inicio(), f)); document.add(new Paragraph("Data trmino..: " + processo.getData_termino(), f)); document.add(new Paragraph("Comarca..: " + processo.getComarca(), f)); document.add(new Paragraph("Vara..: " + processo.getVara(), f)); document.add(new Paragraph("Assesoria..: " + assesoria.getNome(), f)); document.add(new Paragraph("Advogado..: " + assesoria.getNome_advogado(), f)); document.close(); JOptionPane.showMessageDialog(null, "RELATRIO CRIADO COM SUCESSO!\n" + local); try { java.awt.Desktop.getDesktop().open(new File(local)); } catch (IOException ex) { Logger.getLogger(Cadastro.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:sistemacontrole.MainWindow.java
private void pararSinalBtActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pararSinalBtActionPerformed //salva os grafico BufferedImage img = new BufferedImage(PainelEntrada.getWidth(), PainelEntrada.getHeight(), BufferedImage.TYPE_INT_RGB); PainelEntrada.print(img.getGraphics()); // or: panel.printAll(...); try {/*from w w w.j ava2s .c om*/ ImageIO.write(img, "jpg", new File("./Raw_Data/PainelEntrada" + this.registro + ".jpg")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } BufferedImage img2 = new BufferedImage(PainelSaida.getWidth(), PainelSaida.getHeight(), BufferedImage.TYPE_INT_RGB); PainelSaida.print(img2.getGraphics()); // or: panel.printAll(...); try { ImageIO.write(img2, "jpg", new File("./Raw_Data/PainelSaida" + this.registro + ".jpg")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } this.registro++; Font fontTITULO2 = new Font(Font.FontFamily.TIMES_ROMAN, 13, Font.NORMAL); Font fontTITULO = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD); fontTITULO.setColor(BaseColor.RED); Font fontDADO = new Font(Font.FontFamily.TIMES_ROMAN, 9, Font.NORMAL); if (cascata) { Paragraph tipo_VALOR = new Paragraph((this.controleT1), fontDADO); Paragraph KP_VALOR = new Paragraph((this.kp_t1), fontDADO); Paragraph KD_VALOR = new Paragraph((this.kd_t1), fontDADO); Paragraph KI_VALOR = new Paragraph((this.ki_t1), fontDADO); Paragraph TI_VALOR = new Paragraph((this.ti_t1), fontDADO); Paragraph TD_VALOR = new Paragraph((this.td_t1), fontDADO); pdfTableCascata.addCell(tipo_VALOR); pdfTableCascata.addCell(KP_VALOR); pdfTableCascata.addCell(KD_VALOR); pdfTableCascata.addCell(KI_VALOR); pdfTableCascata.addCell(TI_VALOR); pdfTableCascata.addCell(TD_VALOR); } // TODO add your handling code here: }
From source file:sistemacontrole.MainWindow.java
public void GerarPDFFuncao() throws BadElementException, IOException { try {/*from w w w.j a va 2s. c om*/ //Define as fontes Font fontOBS = new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.NORMAL); Font fontTITULO2 = new Font(Font.FontFamily.TIMES_ROMAN, 13, Font.NORMAL); Font fontTITULO = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD); fontTITULO.setColor(BaseColor.RED); Font fontDADO = new Font(Font.FontFamily.TIMES_ROMAN, 9, Font.NORMAL); Document doc = new Document(PageSize.A4.rotate()); // adiciona imagem ao pdf Image Logotipo = Image.getInstance("./src/Imagens/imagem_pdf.png"); Logotipo.scalePercent((float) 47.5); PdfPTable tabelaGrfico = new PdfPTable(2); for (int i = 1; i < this.registro; i++) { Image LogotipoI = Image.getInstance("./Raw_Data/PainelEntrada" + i + ".jpg"); Image LogotipoI2 = Image.getInstance("./Raw_Data/PainelSaida" + i + ".jpg"); tabelaGrfico.addCell(LogotipoI); tabelaGrfico.addCell(LogotipoI2); } int count = this.tabelaDetalhes.getRowCount(); PdfWriter.getInstance(doc, new FileOutputStream(TelaPDF.CampoNome.getText() + ".pdf")); doc.open(); PdfPTable pdfTable = new PdfPTable(this.tabelaDetalhes.getColumnCount()); //adding table headers for (int i = 0; i < 15; i++) { pdfTable.addCell(new Paragraph(this.tabelaDetalhes.getColumnName(i), fontTITULO)); } PdfPTable pdfTableAuxiliar = new PdfPTable(this.tabelaDetalhes.getColumnCount()); String[][] valores = new String[15][15]; for (int i = 0; i < 15; i++) { for (int j = 0; j < 15; j++) { valores[i][j] = ""; } } Object[] obj = null; int contador = 1; for (int i = 0; i < count; i++) { for (int j = 0; j < 15; j++) { try { System.out.println("Valor: " + tabelaDetalhes.getModel().getValueAt(i, j).toString() + "Contado: " + contador); valores[i][j] = tabelaDetalhes.getModel().getValueAt(i, j).toString(); } catch (Exception e) { System.out.println("ERRO DEU contador: " + contador); contador++; } } } for (int i = 0; i < count; i++) { for (int j = 0; j < 15; j++) { pdfTableAuxiliar.addCell(new Paragraph(valores[i][j], fontDADO)); } } Paragraph title = new Paragraph("Sistema de Controle de Tanques - TC Control" + "\n\n", fontTITULO2); title.setAlignment(Paragraph.ALIGN_CENTER); Calendar calendar = new GregorianCalendar(); Date trialTime = new Date(); calendar.setTime(trialTime); Paragraph DIA = new Paragraph("Data: " + calendar.get(Calendar.DATE) + "/" + (calendar.get(Calendar.MONTH) + 1) + "/" + calendar.get(Calendar.YEAR)); Paragraph HORA = new Paragraph("Hora: " + calendar.get(Calendar.HOUR_OF_DAY) + ":" + calendar.get(Calendar.MINUTE) + ":" + calendar.get(Calendar.SECOND)); DIA.setAlignment(Paragraph.ALIGN_RIGHT); HORA.setAlignment(Paragraph.ALIGN_RIGHT); Paragraph espaco = new Paragraph("\n"); Paragraph aviso = new Paragraph("\nGraficos dos Testes ordenados:"); aviso.setAlignment(Paragraph.ALIGN_CENTER); Paragraph autores = new Paragraph( "\n" + "Desenvolvedores: @AlexandeLUZ - @AndersonDIAS - @HigoBESSA - @JaimeDANTAS", fontDADO); autores.setAlignment(Paragraph.ALIGN_CENTER); Paragraph obs = new Paragraph("\n" + "Observaes: " + TelaPDF.observacoes.getText(), fontOBS); obs.setAlignment(Paragraph.ALIGN_CENTER); //PARTE DO CASCATA DO TANQUE 1 Paragraph cascataTitulo = new Paragraph("Parmetros do Tanque 1 (Escravo): ", fontTITULO2); cascataTitulo.setAlignment(Paragraph.ALIGN_CENTER); //PdfPTable pdfTableCascata = new PdfPTable(5); // if(cascata){ // // Paragraph KP = new Paragraph("\n" + // "Kp" ,fontTITULO); // pdfTableCascata.addCell(KP); // Paragraph KD = new Paragraph("\n" + // "Kd" ,fontTITULO); // pdfTableCascata.addCell(KD); // Paragraph KI = new Paragraph("\n" + // "Ki" ,fontTITULO); // pdfTableCascata.addCell(KI); // Paragraph TI = new Paragraph("\n" + // "Ti" ,fontTITULO); // pdfTableCascata.addCell(TI); // Paragraph TD = new Paragraph("\n" + // "Td" ,fontTITULO); // pdfTableCascata.addCell(TD); // Paragraph KP_VALOR = new Paragraph((this.kp_t1),fontDADO); // Paragraph KD_VALOR = new Paragraph((this.kd_t1),fontDADO); // Paragraph KI_VALOR = new Paragraph((this.ki_t1),fontDADO); // Paragraph TI_VALOR = new Paragraph((this.ti_t1),fontDADO); // Paragraph TD_VALOR = new Paragraph((this.td_t1),fontDADO); // pdfTableCascata.addCell(KP_VALOR); // pdfTableCascata.addCell(KD_VALOR); // pdfTableCascata.addCell(KI_VALOR); // pdfTableCascata.addCell(TI_VALOR); // pdfTableCascata.addCell(TD_VALOR); // // } doc.add(Logotipo); doc.add(title); doc.add(pdfTable); doc.add(pdfTableAuxiliar); if (cascata) { doc.add(cascataTitulo); doc.add(espaco); doc.add(pdfTableCascata); } doc.add(obs); doc.add(aviso); //doc.add(espaco); doc.add(tabelaGrfico); doc.add(espaco); doc.add(espaco); doc.add(DIA); doc.add(HORA); doc.add(autores); doc.close(); System.out.println("done"); mostrarAviso("Arquivo criado com sucesso!"); TelaPDF.setVisible(false); } catch (DocumentException ex) { Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); mostrarErro("Erro ao gerar PDF!"); } catch (FileNotFoundException ex) { Logger.getLogger(MainWindow.class.getName()).log(Level.SEVERE, null, ex); mostrarErro("Erro ao gerar PDF!"); } }
From source file:storehausimport.SaveToPdf.java
public boolean save(String inputFilePath, String outputFilePath) throws Exception { if (outputFilePath.isEmpty()) { throw new Exception("Trkst parametrs outputFilePath"); }/* w w w . j a v a 2 s .c om*/ if (inputFilePath.isEmpty()) { throw new Exception("Trkst parametrs inputFilePath"); } File inputFile = new File(inputFilePath); Document pdfDoc = new Document(); try { PdfWriter writer = PdfWriter.getInstance(pdfDoc, new FileOutputStream(outputFilePath)); pdfDoc.open(); pdfDoc.setMarginMirroring(true); pdfDoc.setMargins(36, 72, 108, 180); pdfDoc.topMargin(); BaseFont helvetica = BaseFont.createFont("Helvetica", BaseFont.CP1257, BaseFont.NOT_EMBEDDED); Font normal_font = new Font(helvetica, 10, Font.NORMAL); Font bold_font = new Font(); bold_font.setStyle(Font.BOLD); bold_font.setSize(10); pdfDoc.add(new Paragraph("\n")); if (inputFile.exists()) { iStream = new FileInputStream(inputFile); in = new DataInputStream(iStream); is = new InputStreamReader(in); br = new BufferedReader(is); String strLine; while ((strLine = br.readLine()) != null) { Paragraph para = new Paragraph(strLine + "\n", normal_font); para.setAlignment(Element.ALIGN_LEFT); pdfDoc.add(para); } } else { pdfDoc.close(); throw new Exception("Trkst parametrs inputFilePath"); } pdfDoc.close(); } catch (Exception ex) { throw new Exception(ex); } return true; }
From source file:userInterface.SystemAdmin.PovertyAnalysisJPanel.java
private void downloadPDFJButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadPDFJButtonActionPerformed Document document = new Document(); try {/* w w w .ja v a 2 s . c o m*/ PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("AddTableExample.pdf")); document.open(); Font helveticaBold = FontFactory.getFont(FontFactory.HELVETICA, 16, Font.NORMAL, new GrayColor(1)); Font helveticaNormal = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new GrayColor(1)); Paragraph paragraphOne = new Paragraph("Safety Meter Report", helveticaBold); document.add(paragraphOne); document.add(new Paragraph(" ")); DefaultTableModel model = (DefaultTableModel) povertyJTable.getModel(); int numRows = model.getRowCount(); int numColum = model.getColumnCount(); int i, j = 0; for (i = 0; i < numRows; i++) { Paragraph info = new Paragraph("Network Name is " + model.getValueAt(i, 0), helveticaNormal); Paragraph sectionContent3 = new Paragraph( "Average Income of A Person is $" + model.getValueAt(i, 2), helveticaNormal); info.add(sectionContent3); Paragraph sectionContent1 = new Paragraph("Crime Rate is " + model.getValueAt(i, 6) + "%", helveticaNormal); info.add(sectionContent1); Paragraph sectionContent2 = new Paragraph("Poverty Rate is " + model.getValueAt(i, 4) + "%", helveticaNormal); info.add(sectionContent2); Paragraph sectionContent4 = new Paragraph( "Percentage of People Having FireArms " + model.getValueAt(i, 3) + "%", helveticaNormal); info.add(sectionContent4); document.add(info); Paragraph space = new Paragraph(" ", helveticaNormal); document.add(space); } //document.add(table); document.close(); writer.close(); JOptionPane.showMessageDialog(povertyJTable, "Please visit Downloads folder to view your report"); } catch (Exception e) { JOptionPane.showMessageDialog(povertyJTable, e); } }
From source file:util.ImageExample.java
public ImageExample(Calendar date, int settings, ArrayList<String> courses, String time, String eventAddress, int totalPrice, String comments, boolean kunde) throws Exception { this.date = date; this.settings = settings; this.courses = courses; this.time = time; this.eventAddress = eventAddress; this.totalPrice = totalPrice; this.comments = comments; this.fileName = ""; GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); ge.getAllFonts();//from w w w. j a v a 2 s .com FontFactory.register("C:/Windows/Fonts/ARLRDBD.TTF", "Arial Rounded"); Font font = FontFactory.getFont("Arial Rounded", 22, Font.NORMAL, new BaseColor(51, 102, 102)); Document document = new Document(); System.out.println("Pdf creation startet"); try { if (kunde) { fileName = "grill" + new SimpleDateFormat("dd. MMMMM yyyy hhmm").format(date.getTime()) + ".pdf"; } else { fileName = "grill" + new SimpleDateFormat("dd. MMMMM yyyy hhmm").format(date.getTime()) + "Prisliste.pdf"; } FileOutputStream file = new FileOutputStream(new File("C:/Users/Mark/Desktop", fileName)); PdfWriter writer = PdfWriter.getInstance(document, file); document.open(); Image img = Image.getInstance("src/pictures/cirkles.png"); img.scaleToFit(277, 277); img.setAbsolutePosition(40, PageSize.A4.getHeight() - img.getHeight()); document.add(img); Chunk chunk = new Chunk("Grillmester 'Frankie'", font); chunk.setCharacterSpacing(3); Paragraph header = new Paragraph(chunk); header.setAlignment(Element.ALIGN_RIGHT); header.setSpacingBefore(15); document.add(header); Paragraph title = new Paragraph( "Tilbud angende d. " + new SimpleDateFormat("dd. MMMMM yyyy").format(date.getTime()) + ".", new Font(Font.FontFamily.TIMES_ROMAN, 20, Font.BOLD)); title.setAlignment(Element.ALIGN_LEFT); title.setIndentationLeft(235); title.setSpacingBefore(100); title.setLeading(17); document.add(title); Paragraph subtitle = new Paragraph("(Arrangement til " + settings + " personer).", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.ITALIC)); subtitle.setAlignment(Element.ALIGN_LEFT); subtitle.setIndentationLeft(235); subtitle.setLeading(17); document.add(subtitle); Paragraph body = new Paragraph("\n\nDer er aftalt:\n\n", new Font(Font.FontFamily.TIMES_ROMAN, 18)); body.setAlignment(Element.ALIGN_LEFT); body.setIndentationLeft(235); body.setLeading(17); for (String course : courses) { body.add(course + "\n\n"); } body.add("\nServeres klokken " + time + " i " + eventAddress + "."); document.add(body); Paragraph ending = new Paragraph("\n\n\nPris: " + totalPrice + ",-kr.", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD)); ending.setAlignment(Element.ALIGN_LEFT); ending.setIndentationLeft(235); ending.setLeading(17); document.add(ending); if (!comments.equals("null")) { if (!comments.equals("")) { Paragraph comment = new Paragraph("\n\nKommentarer\n" + comments, new Font(Font.FontFamily.TIMES_ROMAN, 18)); comment.setAlignment(Element.ALIGN_LEFT); comment.setIndentationLeft(235); comment.setLeading(17); document.add(comment); } } Image footerImg = Image.getInstance("src/pictures/grillmester.png"); footerImg.scaleToFit(210, 210); footerImg.setAbsolutePosition(40, 40); document.add(footerImg); Image img2 = Image.getInstance("src/pictures/Contact.png"); img2.scaleToFit(250, 250); img2.setAbsolutePosition(20, PageSize.A4.getHeight() - img.getHeight() - 250); document.add(img2); document.close(); System.out.println("Pdf finish"); } catch (Exception e) { e.printStackTrace(); System.out.println(e.getLocalizedMessage()); } }
From source file:utils.PrintUtils.java
public static void imprimerRecu(Eleve eleve, Eleveanneeclasse classe, Tranche tranche, int montant, int reste, Annee annee) {/*from w w w. jav a2 s . c om*/ try { String recuName = eleve.getNom() + "_" + eleve.getPrenom() + "" + tranche.getNom() + ".pdf"; Document recu = new Document(); PdfWriter.getInstance(recu, new FileOutputStream(Utilitaires.path + "/" + recuName)); recu.open(); PdfPTable table = new PdfPTable(4); table.addCell(PrintUtils.createPdfPCell( "COLLEGE POZAM , Anne Scolaire " + annee.getCode() + "-" + (annee.getCode() + 1), 5, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("Nom de l'lve", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("Prnom", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("Matricule", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("Classe", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("" + eleve.getNom(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("" + eleve.getPrenom(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("" + eleve.getMatricule(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("" + classe.getIdclasse().getNom(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("A vers un montant de #" + montant + "Fcfa#", 4, false, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell( "En lettres ........................................................ ", 4, false, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("Pour payement des frais de la : " + tranche.getNom(), 4, false, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("A...............", 2, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("Le..............", 2, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("Visa de l'conome", 2, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("Visa de l'lve", 2, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("...", 2, true)); table.addCell(PrintUtils.createPdfPCell("...", 2, true)); recu.add(table); recu.close(); } catch (DocumentException ex) { Logger.getLogger(PrintUtils.class.getName()).log(Level.SEVERE, null, ex); } catch (FileNotFoundException ex) { Logger.getLogger(PrintUtils.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:utils.PrintUtils.java
public static void printAnnualReportNote(Annee annee, Trimesteannee trimesteannee, Classe classe, ClasseElementevaluation classeElementevaluation, List<Eleveanneeclasse> eleveanneeclasses, List<Trimesteannee> trimesteannees, List<Sequenceannee> sequenceannees, ClasseElementevaluationFacadeLocal classeElementevaluationFacadeLocal, PlanningEvaluationFacadeLocal planningEvaluationFacadeLocal, EvaluationFacadeLocal evaluationFacadeLocal, SequenceanneeFacadeLocal sequenceanneeFacadeLocal) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); String fichier = "proces_verbal_note" + "_" + annee.getCode() + "-" + annee.getCodefin() + "_" + classe.getNom() + ".pdf"; Document rapport = new Document(PageSize.A4.rotate()); PdfWriter.getInstance(rapport, new FileOutputStream( Utilitaires.path + "/" + Utilitaires.repertoireParDefaultNotesAnnuel + "/" + fichier)); rapport.open();// ww w. java 2s . c o m rapport.add(new Paragraph("Anne Scolaire : " + annee.getCode() + " / " + annee.getCodefin())); rapport.add(new Paragraph("Classe : " + classe.getNom())); rapport.add( new Paragraph("Unit Evaluation : " + classeElementevaluation.getElementevaluation().getNom())); rapport.add(new Paragraph("Periode : " + annee.getCode() + " - " + annee.getCodefin())); rapport.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(2 + sequenceannees.size()); table.setWidthPercentage(100); table.addCell(PrintUtils.createPdfPCell("PROCES VERBAL ANNUEL DES NOTES ", 2 + sequenceannees.size(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("ELEVES", 2, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))).setRowspan(2); table.addCell(PrintUtils.createPdfPCell("NOTES", sequenceannees.size(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); for (Trimesteannee t : trimesteannees) { table.addCell(PrintUtils.createPdfPCell("" + t.getIdtrimestre().getNom(), sequenceanneeFacadeLocal.getByTrimestre(t.getIdtrimestrean()).size(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); } table.addCell(PrintUtils.createPdfPCell("MATRICULE", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("NOM(S) ET PRENOM(S)", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); for (Sequenceannee s : sequenceannees) { table.addCell(PrintUtils.createPdfPCell("" + s.getIdsequence().getNom(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); } for (Eleveanneeclasse e : eleveanneeclasses) { table.addCell(PrintUtils.createPdfPCell("" + e.getEleve().getMatricule(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("" + e.getEleve().getNom() + " " + e.getEleve().getPrenom(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); for (Sequenceannee s1 : sequenceannees) { String r = findNote1(e, s1, classeElementevaluation, classeElementevaluationFacadeLocal, planningEvaluationFacadeLocal, evaluationFacadeLocal); table.addCell(PrintUtils.createPdfPCell("" + r, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); } } rapport.add(table); rapport.close(); }
From source file:utils.PrintUtils.java
public static void printTrimestrialReportNote(Annee annee, Trimesteannee trimesteannee, Classe classe, ClasseElementevaluation classeElementevaluation, List<Eleveanneeclasse> eleveanneeclasses, List<Sequenceannee> sequenceannees, ClasseElementevaluationFacadeLocal classeElementevaluationFacadeLocal, PlanningEvaluationFacadeLocal planningEvaluationFacadeLocal, EvaluationFacadeLocal evaluationFacadeLocal) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); String fichier = "proces_verbal_note" + "_" + trimesteannee.getIdtrimestre().getNom() + "_" + classe.getNom() + ".pdf"; Document rapport = new Document(PageSize.A4.rotate()); PdfWriter.getInstance(rapport, new FileOutputStream( Utilitaires.path + "/" + Utilitaires.repertoireParDefaultNotesTrim + "/" + fichier)); rapport.open();// w ww .j av a 2 s. c o m rapport.add(new Paragraph("Anne Scolaire : " + annee.getCode() + " / " + annee.getCodefin())); rapport.add(new Paragraph("Classe : " + classe.getNom())); rapport.add( new Paragraph("Unit Evaluation : " + classeElementevaluation.getElementevaluation().getNom())); rapport.add(new Paragraph("Priode : " + trimesteannee.getIdtrimestre().getNom())); rapport.add(new Paragraph(" ")); PdfPTable table = new PdfPTable(2 + sequenceannees.size()); table.setWidthPercentage(100); table.addCell(PrintUtils.createPdfPCell("PROCES VERBAL TRIMESTRIEL DES NOTES ", 2 + sequenceannees.size(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("ELEVES", 2, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("NOTES", sequenceannees.size(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("MATRICULE", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("NOM(S) ET PRENOM(S)", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); for (Sequenceannee s : sequenceannees) { table.addCell(PrintUtils.createPdfPCell("" + s.getIdsequence().getNom(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); } for (Eleveanneeclasse e : eleveanneeclasses) { table.addCell(PrintUtils.createPdfPCell("" + e.getEleve().getMatricule(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("" + e.getEleve().getNom() + " " + e.getEleve().getPrenom(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); for (Sequenceannee s1 : sequenceannees) { String r = findNote1(e, s1, classeElementevaluation, classeElementevaluationFacadeLocal, planningEvaluationFacadeLocal, evaluationFacadeLocal); table.addCell(PrintUtils.createPdfPCell("" + r, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); } } rapport.add(table); rapport.close(); }
From source file:utils.PrintUtils.java
public static void printSequentialReportNote(Annee annee, Sequenceannee sequenceannee, Classe classe, List<Evaluation> evaluations) throws Exception { SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); String fichier = "proces_verbal_note" + "_" + sequenceannee.getIdsequence().getNom() + "_" + classe.getNom() + ".pdf"; Document rapport = new Document(); PdfWriter.getInstance(rapport, new FileOutputStream( Utilitaires.path + "/" + Utilitaires.repertoireParDefaultNotes + "/" + fichier)); rapport.open();/*from w ww. j a v a 2 s .c o m*/ rapport.add(new Paragraph("Anne Scolaire : " + annee.getCode() + " / " + annee.getCodefin())); rapport.add(new Paragraph("Classe : " + classe.getNom())); rapport.add(new Paragraph("Evaluation : " + evaluations.get(0).getPlanningEvaluation() .getElementEvaluation().getElementevaluation().getNom())); rapport.add(new Paragraph("Priode : " + sequenceannee.getIdsequence().getNom())); rapport.add(new Paragraph(" ")); float[] widths = { 1f, 3f, 0.5f, 1f }; PdfPTable table = new PdfPTable(widths); table.setWidthPercentage(100); table.addCell(PrintUtils.createPdfPCell("PROCES VERBAL DES NOTES ", 4, true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("Matricule", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("Nom(s) et Prnom(s)", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell( PrintUtils.createPdfPCell("Note", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("Observation", true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); for (Evaluation e : evaluations) { table.addCell(PrintUtils.createPdfPCell("" + e.getEleve().getMatricule(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("" + e.getEleve().getNom() + " " + e.getEleve().getPrenom(), false, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("" + e.getNote(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); table.addCell(PrintUtils.createPdfPCell("" + e.getObservation(), true, new Font(Font.FontFamily.TIMES_ROMAN, 11, Font.NORMAL))); } rapport.add(table); rapport.close(); }