List of usage examples for com.itextpdf.text BaseColor BLUE
BaseColor BLUE
To view the source code for com.itextpdf.text BaseColor BLUE.
Click Source Link
From source file:com.sapito.pdf.PDFView.PDFGeneratorDireccion.java
public void reporteinventario(Map<String, Object> model, HttpServletResponse hsr1, List<Inventario> inventario) throws Exception { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open();//from w w w .ja v a 2s . c o m document.addTitle("Sapito PDFs"); document.addSubject("Pdf de sapito"); Font font1 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 30); font1.setColor(BaseColor.BLACK); Font font2 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 24); font2.setColor(BaseColor.BLACK); document.add(new Paragraph("TAILS 2015", font1)); document.add(new Paragraph("Reportes Direccin\n", font2)); //------------------------ TAIS ______________________________ Image tais = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/tais-banner.jpg")); document.add(tais); //--------------------- BODY --------------------------------------------------------- Image body = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/body.png")); body.setAlignment(Image.UNDERLYING); body.setTransparency(new int[] { 0x00, 0x10 }); body.setAbsolutePosition(50, 250); document.add(body); //------------------------------------------------------------------------------------------- Image footer = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/footer.jpg")); footer.setAbsolutePosition(50, 20); document.add(footer); //---------------------- TITLE --------------------------- String titulo = "Reporte de Inventarios"; //Cambiar el titulo del PDF aqui Font f = new Font(FontFamily.HELVETICA, 25.0f, Font.BOLD, BaseColor.BLACK); Chunk c = new Chunk(titulo + " \n ", f); c.setBackground(BaseColor.WHITE); Paragraph title = new Paragraph(c); title.setAlignment(Element.ALIGN_CENTER); //------------------------- CONTENIDO ------------------------------------------------------- document.add(title); //Titulo del PDF TextoPdf x = (TextoPdf) model.get("todoTexto"); document.add(new Paragraph(x.getTodoTexto())); PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100.0f); table.setWidths(new float[] { 2.0f }); table.setSpacingBefore(10); // define font for table header row Font font = FontFactory.getFont(FontFactory.COURIER_BOLD); font.setColor(BaseColor.WHITE); // define table header cell PdfPCell cell = new PdfPCell(); cell.setBackgroundColor(BaseColor.BLUE); cell.setPadding(5); // write table header cell.setPhrase(new Phrase("Total de Inventarios", font)); table.addCell(cell); for (int i = 0; i < inventario.size(); i++) { a = inventario.get(i).getPrecioUnitario(); b = a + b; } String bla = b + " "; table.addCell(bla); document.add(table); //-------------------------- FIN CONTENIDO ----------------- document.close(); byte[] bytes = baos.toByteArray(); hsr1.setContentType("application/pdf"); hsr1.setContentLength(bytes.length); hsr1.getOutputStream().write(bytes); }
From source file:com.sapito.pdf.PDFView.PDFGeneratorDireccion.java
public void reporteRH(Map<String, Object> model, HttpServletResponse hsr1, int detalle) throws Exception { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open();// www. j av a 2 s . c o m document.addTitle("Sapito PDFs"); document.addSubject("Pdf de sapito"); Font font1 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 30); font1.setColor(BaseColor.BLACK); Font font2 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 24); font2.setColor(BaseColor.BLACK); document.add(new Paragraph("TAILS 2015", font1)); document.add(new Paragraph("Reportes Direccin\n", font2)); //------------------------ TAIS ______________________________ Image tais = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/tais-banner.jpg")); document.add(tais); //--------------------- BODY --------------------------------------------------------- Image body = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/body.png")); body.setAlignment(Image.UNDERLYING); body.setTransparency(new int[] { 0x00, 0x10 }); body.setAbsolutePosition(50, 250); document.add(body); //------------------------------------------------------------------------------------------- Image footer = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/footer.jpg")); footer.setAbsolutePosition(50, 20); document.add(footer); //---------------------- TITLE --------------------------- String titulo = "Reporte de Recursos Humanos"; //Cambiar el titulo del PDF aqui Font f = new Font(FontFamily.HELVETICA, 25.0f, Font.BOLD, BaseColor.BLACK); Chunk c = new Chunk(titulo + " \n ", f); c.setBackground(BaseColor.WHITE); Paragraph title = new Paragraph(c); title.setAlignment(Element.ALIGN_CENTER); //------------------------- CONTENIDO ------------------------------------------------------- document.add(title); //Titulo del PDF TextoPdf x = (TextoPdf) model.get("todoTexto"); document.add(new Paragraph(x.getTodoTexto())); PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100.0f); table.setWidths(new float[] { 2.0f }); table.setSpacingBefore(10); // define font for table header row Font font = FontFactory.getFont(FontFactory.COURIER_BOLD); font.setColor(BaseColor.WHITE); // define table header cell PdfPCell cell = new PdfPCell(); cell.setBackgroundColor(BaseColor.BLUE); cell.setPadding(5); // write table header cell.setPhrase(new Phrase("Total de de Empleados en Vacaciones", font)); table.addCell(cell); String bla = detalle + " "; table.addCell(bla); document.add(table); //-------------------------- FIN CONTENIDO ----------------- document.close(); byte[] bytes = baos.toByteArray(); hsr1.setContentType("application/pdf"); hsr1.setContentLength(bytes.length); hsr1.getOutputStream().write(bytes); }
From source file:com.sapito.pdf.PDFView.PDFGeneratorDireccion.java
public void reportefinanzas(Map<String, Object> model, HttpServletResponse hsr1, List<CuentaBancaria> cuenta) throws Exception { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open();/*from w ww. j a v a 2 s . c o m*/ document.addTitle("Sapito PDFs"); document.addSubject("Pdf de sapito"); Font font1 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 30); font1.setColor(BaseColor.BLACK); Font font2 = FontFactory.getFont(FontFactory.TIMES_ROMAN, 24); font2.setColor(BaseColor.BLACK); document.add(new Paragraph("TAILS 2015", font1)); document.add(new Paragraph("Reportes Direccin\n", font2)); //------------------------ TAIS ______________________________ Image tais = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/tais-banner.jpg")); document.add(tais); //--------------------- BODY --------------------------------------------------------- Image body = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/body.png")); body.setAlignment(Image.UNDERLYING); body.setTransparency(new int[] { 0x00, 0x10 }); body.setAbsolutePosition(50, 250); document.add(body); //------------------------------------------------------------------------------------------- Image footer = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/footer.jpg")); footer.setAbsolutePosition(50, 20); document.add(footer); //---------------------- TITLE --------------------------- String titulo = "Reporte de Finanzas"; //Cambiar el titulo del PDF aqui Font f = new Font(FontFamily.HELVETICA, 25.0f, Font.BOLD, BaseColor.BLACK); Chunk c = new Chunk(titulo + " \n ", f); c.setBackground(BaseColor.WHITE); Paragraph title = new Paragraph(c); title.setAlignment(Element.ALIGN_CENTER); //------------------------- CONTENIDO ------------------------------------------------------- document.add(title); //Titulo del PDF TextoPdf x = (TextoPdf) model.get("todoTexto"); document.add(new Paragraph(x.getTodoTexto())); PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100.0f); table.setWidths(new float[] { 2.0f }); table.setSpacingBefore(10); // define font for table header row Font font = FontFactory.getFont(FontFactory.COURIER_BOLD); font.setColor(BaseColor.WHITE); // define table header cell PdfPCell cell = new PdfPCell(); cell.setBackgroundColor(BaseColor.BLUE); cell.setPadding(5); // write table header cell.setPhrase(new Phrase("Total de dinero que se tiene en CUENTAS BANCARIAS", font)); table.addCell(cell); for (int i = 0; i < cuenta.size(); i++) { a = cuenta.get(i).getHaber(); b = b + a; } String bla = b + " "; table.addCell(bla); document.add(table); //-------------------------- FIN CONTENIDO ----------------- document.close(); byte[] bytes = baos.toByteArray(); hsr1.setContentType("application/pdf"); hsr1.setContentLength(bytes.length); hsr1.getOutputStream().write(bytes); }
From source file:ConexionBD.CreaPrefichaPDF.java
public static void drawRectangle(PdfContentByte content, float x, float y, float width, float height) { content.saveState();/* w w w. j av a 2 s.c o m*/ PdfGState state = new PdfGState(); content.setGState(state); content.setRGBColorFill(232, 232, 232); content.setColorStroke(BaseColor.BLUE); content.setLineWidth((float) .5); content.rectangle(x, y, width, height); content.fillStroke(); content.restoreState(); }
From source file:ConexionBD.CreaPrefichaPDF.java
public static void drawRectangleSC(PdfContentByte content, float x, float y, float width, float height) { content.saveState();/* ww w. j av a 2 s .c om*/ PdfGState state = new PdfGState(); content.setGState(state); content.setRGBColorFill(0xFF, 0xFF, 0xFA); content.setColorStroke(BaseColor.BLUE); content.setLineWidth((float) .5); content.rectangle(x, y, width, height); content.fillStroke(); content.restoreState(); }
From source file:ConexionBD.CreaPrefichaPDF.java
public static void drawRectangleText(PdfContentByte content, float x, float y, float width, float height) { content.saveState();/*from w ww .ja v a 2s. c o m*/ PdfGState state = new PdfGState(); content.setGState(state); content.setRGBColorFill(0, 230, 255); content.setColorStroke(BaseColor.BLUE); content.setLineWidth((float) .5); content.rectangle(x, y, width, height); content.fillStroke(); content.restoreState(); }
From source file:Controlador.PDF.java
public String escribePDF(String nombre) { FileOutputStream ficheroPdf = null; Random r = new Random(); r.setSeed(System.currentTimeMillis()); String f_nombre = "cons" + nombre + r.nextInt(9000) + ".pdf"; try {/*from ww w . j av a2 s .c o m*/ Document documento = new Document(); String basePath = new File("").getAbsolutePath(); String[] parts = basePath.split("/"); final String path = "/" + parts[1] + "/" + parts[2] + "/NetBeansProjects/pag_ingles/web/" + f_nombre; ficheroPdf = new FileOutputStream(path); PdfWriter.getInstance(documento, ficheroPdf).setInitialLeading(20); documento.open(); Image foto = Image.getInstance( "/" + parts[1] + "/" + parts[2] + "/NetBeansProjects/pag_ingles/web/img/escuela.png"); foto.scaleToFit(200, 200); foto.setAlignment(Chunk.ALIGN_RIGHT); documento.add(foto); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph("Darktech Anglo Institute", FontFactory.getFont("Courier-Bold", 30, Font.UNDERLINE, BaseColor.BLUE))); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" OTORGA LA PRESENTEaaa", FontFactory.getFont("ARIAL", 30, Font.NORMAL, BaseColor.BLACK))); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" CONSTANCIA", FontFactory.getFont("ARIAL", 30, Font.NORMAL, BaseColor.BLACK))); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" A : " + nombre, FontFactory.getFont("ARIAL", 20, Font.BOLD, BaseColor.BLACK))); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph(" ")); documento.add(new Paragraph("POR HABER CONCLUIDO CON EXITO EL CURSO DE INGLES.", FontFactory.getFont("ARIAL", 14, Font.NORMAL, BaseColor.BLACK))); documento.close(); ficheroPdf.close(); Thread.sleep(3000); } catch (DocumentException | FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException ex) { Logger.getLogger(PDF.class.getName()).log(Level.SEVERE, null, ex); } finally { try { ficheroPdf.close(); } catch (IOException e) { e.printStackTrace(); } } return f_nombre; }
From source file:controlador.PDFServlet.java
/** * Processes requests for both HTTP <code>GET</code> and <code>POST</code> * methods.//w ww . j a v a2s. c o m * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, BadElementException, DocumentException { response.setContentType("text/html;charset=UTF-8"); try (PrintWriter out = response.getWriter()) { this.cliente = new ClienteDAO(); ArrayList c = cliente.listarTodo(); FileOutputStream archivo = new FileOutputStream( "C:\\Users\\ayoro\\OneDrive\\Documents\\NetBeansProjects\\Proyecto2\\ExpoturismoDriver\\archivo.pdf"); Document documento = new Document(); PdfWriter.getInstance(documento, archivo); documento.open(); documento.add(new Paragraph("Clientes!")); documento.add(new Paragraph("Pruebita del primer pdf", FontFactory.getFont("arial", // fuente 22, // tamao Font.ITALIC, // estilo BaseColor.CYAN))); // color documento.add( new Paragraph("Nueva tablita", FontFactory.getFont("arial", 28, Font.BOLD, BaseColor.BLUE))); documento.add(Chunk.NEWLINE); PdfPTable tabla = new PdfPTable(4); Paragraph ced = new Paragraph("Cdula", FontFactory.getFont("arial", 12, Font.BOLD, BaseColor.BLACK)); Paragraph nom = new Paragraph("Nombre", FontFactory.getFont("arial", 12, Font.BOLD, BaseColor.BLACK)); Paragraph cor = new Paragraph("Correo", FontFactory.getFont("arial", 12, Font.BOLD, BaseColor.BLACK)); Paragraph tel = new Paragraph("Telfono", FontFactory.getFont("arial", 12, Font.BOLD, BaseColor.BLACK)); tabla.addCell(ced); tabla.addCell(nom); tabla.addCell(cor); tabla.addCell(tel); for (int i = 0; i < c.size(); i += 4) { tabla.addCell("" + c.get(i)); tabla.addCell((String) c.get(i + 1)); tabla.addCell((String) c.get(i + 2)); tabla.addCell("" + c.get(i + 3)); } documento.add(tabla); documento.add(new Paragraph("Finito")); documento.add(new Paragraph("Prueba 2")); documento.close(); response.sendRedirect("opciones.jsp"); } }
From source file:controller.CreateTranscript.java
private void CreateTranscript(MyPerson p) {//,PrintWriter out){ Document document = new Document(); String name = p.getFName() + p.getLName(); try {/*w w w. j av a 2 s .co m*/ if (p.getUserType() == 6) { PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("D:\\" + name + ".pdf")); document.open(); PdfPTable table = new PdfPTable(8); // 8 columns. table.setWidthPercentage(100); //Width 100% table.setSpacingBefore(10f); //Space before table table.setSpacingAfter(10f); //Space after table //Set Column widths float[] columnWidths = { 1f, 1f, 1f, 1f, 1f, 1f, 1f, 1f }; table.setWidths(columnWidths); PdfPCell cell1 = new PdfPCell(new Paragraph("Subject Name")); cell1.setBorderColor(BaseColor.BLUE); cell1.setPaddingLeft(10); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); cell1.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell2 = new PdfPCell(new Paragraph("Subject Code")); cell2.setBorderColor(BaseColor.BLUE); cell2.setPaddingLeft(10); cell2.setHorizontalAlignment(Element.ALIGN_CENTER); cell2.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell3 = new PdfPCell(new Paragraph("Written Grade")); cell3.setBorderColor(BaseColor.BLUE); cell3.setPaddingLeft(10); cell3.setHorizontalAlignment(Element.ALIGN_CENTER); cell3.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell4 = new PdfPCell(new Paragraph("Midterm Grade")); cell4.setBorderColor(BaseColor.BLUE); cell4.setPaddingLeft(10); cell4.setHorizontalAlignment(Element.ALIGN_CENTER); cell4.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell5 = new PdfPCell(new Paragraph("Final Exam Grade")); cell5.setBorderColor(BaseColor.BLUE); cell5.setPaddingLeft(10); cell5.setHorizontalAlignment(Element.ALIGN_CENTER); cell5.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell6 = new PdfPCell(new Paragraph("Final Grade")); cell6.setBorderColor(BaseColor.BLUE); cell6.setPaddingLeft(10); cell6.setHorizontalAlignment(Element.ALIGN_CENTER); cell6.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell7 = new PdfPCell(new Paragraph("Term")); cell7.setBorderColor(BaseColor.BLUE); cell7.setPaddingLeft(10); cell7.setHorizontalAlignment(Element.ALIGN_CENTER); cell7.setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell8 = new PdfPCell(new Paragraph("Registration Date")); cell8.setBorderColor(BaseColor.BLUE); cell8.setPaddingLeft(10); cell8.setHorizontalAlignment(Element.ALIGN_CENTER); cell8.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell1); table.addCell(cell2); table.addCell(cell3); table.addCell(cell4); table.addCell(cell5); table.addCell(cell6); table.addCell(cell7); table.addCell(cell8); ModelOfStudent modelOfStudent = new ModelOfStudent(); ResultSet rs = modelOfStudent.ViewMyCourses(p.getCode()); // if(!rs.next()){out.println("<font color='blue'>There is no Courses Untill Now ^_^ </font>");} while (rs.next()) { table.addCell(rs.getString("SubjectName")); table.addCell(rs.getString("ID")); table.addCell(rs.getString("WritenGrade")); table.addCell(rs.getString("MidtermGrade")); table.addCell(rs.getString("FinalExamGrade")); table.addCell(rs.getString("FinalGrade")); table.addCell(rs.getString("Term")); table.addCell(rs.getString("StudentRegisterSubjectDate")); /* String SubjectRegisterDate=String.valueOf(rs.getDate("SubjectRegisterDate")); table.addCell(SubjectRegisterDate); */ } //To avoid having the cell border and the content overlap, if you are having thick cell borders //cell1.setUserBorderPadding(true); //cell2.setUserBorderPadding(true); //cell3.setUserBorderPadding(true); document.add(new Paragraph("University: " + MyPerson.ReturnUniversityName(p.getCode()))); document.add(new Paragraph("Faculity: " + MyPerson.ReturnFaculityName(p.getCode()))); document.add( new Paragraph("Student Name: " + p.getFName() + " " + p.getMName() + " " + p.getLName())); document.add(new Paragraph("Level: " + MyPerson.ReturnLevelName(p.getCode()))); document.add(new Paragraph("Department: " + MyPerson.ReturnDepartmentName(p.getCode()))); document.add(table); System.out.println( "<script type='text/javascript' > alert('Successfull Creating Transcript ^_^ ');history.back();</script>"); //out.println("Successfull Creating Transcript ^_^"); document.close(); writer.close(); } //end of if student } catch (Exception e) { System.out.println("<script type='text/javascript' > alert('Failed Creating Transcript ^_^ Error:" + e.getMessage() + " ');history.back();</script>"); // out.println(""+e.getMessage()); e.printStackTrace(); } }
From source file:controllerPDF.Pdf3DTAlpha.java
private void addHeader() throws DocumentException { Paragraph paragraph = new Paragraph("3D&T - Defensores de Tquio 3 Edio Alpha"); paragraph.setFont(new Font(FontFamily.TIMES_ROMAN, 15, Font.BOLD, BaseColor.BLACK)); paragraph.setAlignment(1);/*from w ww .j a v a 2 s . co m*/ document.add(paragraph); paragraph = new Paragraph("FICHA DE PERSONAGEM"); paragraph.setFont(new Font(FontFamily.TIMES_ROMAN, 15, Font.BOLD, BaseColor.BLUE)); document.add(paragraph); }