List of usage examples for com.itextpdf.text Image UNDERLYING
int UNDERLYING
To view the source code for com.itextpdf.text Image UNDERLYING.
Click Source Link
From source file:avalonscrollmaker20.AnothakScroll.java
License:Open Source License
public AnothakScroll(String tagNumber, String tagTitle, String tagSchool) { liersethPhrase_Symbol = new ArrayList<Symbol>(); liersethPhrase_Common = new ArrayList<Word>(); spellTitle = tagTitle;/*from w w w . j ava 2 s .co m*/ spellCode = tagNumber.toLowerCase(); // The "Gesture" will always begin a Lierseth Phrase liersethPhrase_Common.add(Word.GESTURE); liersethPhrase_Symbol.add(Symbol.GESTURE); // Assign [Old/New]School, partial Phrases, and involved Keus switch (NewSchool.getValue(tagSchool)) { case THEKSO: spellOldSchool = OldSchool.ENTHE; spellNewSchool = NewSchool.THEKSO; sourceKeu = Keu.EDEN; liersethPhrase_Common.add(Word.TEMME); liersethPhrase_Common.add(Word.THEKSO); liersethPhrase_Common.add(Word.EKS); liersethPhrase_Common.add(Word.SETT); liersethPhrase_Symbol.add(Symbol.TEMME); liersethPhrase_Symbol.add(Symbol.THEKSO); liersethPhrase_Symbol.add(Symbol.EKS); liersethPhrase_Symbol.add(Symbol.SETT); break; case HETTER: spellOldSchool = OldSchool.HEITTUR; spellNewSchool = NewSchool.HETTER; sourceKeu = Keu.HIECIN; liersethPhrase_Common.add(Word.HEPHT); liersethPhrase_Common.add(Word.HETTER); liersethPhrase_Common.add(Word.TRITE); liersethPhrase_Common.add(Word.SETT); liersethPhrase_Symbol.add(Symbol.HEPHT); liersethPhrase_Symbol.add(Symbol.HETTER); liersethPhrase_Symbol.add(Symbol.TRITE); liersethPhrase_Symbol.add(Symbol.SETT); break; case CHATTEN: spellOldSchool = OldSchool.EINSET; spellNewSchool = NewSchool.CHATTEN; sourceKeu = Keu.SEYLIN; liersethPhrase_Common.add(Word.FINN); liersethPhrase_Common.add(Word.CHATTEN); liersethPhrase_Common.add(Word.SIFF); liersethPhrase_Common.add(Word.SETT); liersethPhrase_Symbol.add(Symbol.FINN); liersethPhrase_Symbol.add(Symbol.CHATTEN); liersethPhrase_Symbol.add(Symbol.SIFF); liersethPhrase_Symbol.add(Symbol.SETT); break; case XIETEP: spellOldSchool = OldSchool.XIKIIL; spellNewSchool = NewSchool.XIETEP; sourceKeu = Keu.KEUNA; liersethPhrase_Common.add(Word.ONK); liersethPhrase_Common.add(Word.XIETEP); liersethPhrase_Common.add(Word.CIN); liersethPhrase_Common.add(Word.SETT); liersethPhrase_Symbol.add(Symbol.ONK); liersethPhrase_Symbol.add(Symbol.XIETEP); liersethPhrase_Symbol.add(Symbol.CIN); liersethPhrase_Symbol.add(Symbol.SETT); break; case TASOL: spellOldSchool = OldSchool.TAJEAR; spellNewSchool = NewSchool.TASOL; sourceKeu = Keu.BIRSIN; liersethPhrase_Common.add(Word.LURR); liersethPhrase_Common.add(Word.TASOL); liersethPhrase_Common.add(Word.RISH); liersethPhrase_Common.add(Word.SETT); liersethPhrase_Symbol.add(Symbol.LURR); liersethPhrase_Symbol.add(Symbol.TASOL); liersethPhrase_Symbol.add(Symbol.RISH); liersethPhrase_Symbol.add(Symbol.SETT); break; case OJIIN: spellOldSchool = OldSchool.OGININ; spellNewSchool = NewSchool.OJIIN; sourceKeu = Keu.NORT; liersethPhrase_Common.add(Word.SORN); liersethPhrase_Common.add(Word.OJIIN); liersethPhrase_Common.add(Word.NETT); liersethPhrase_Common.add(Word.SETT); liersethPhrase_Symbol.add(Symbol.SORN); liersethPhrase_Symbol.add(Symbol.OJIIN); liersethPhrase_Symbol.add(Symbol.NETT); liersethPhrase_Symbol.add(Symbol.SETT); break; case ZUN: spellOldSchool = OldSchool.ZANSIN; spellNewSchool = NewSchool.ZUN; sourceKeu = Keu.BUUSIN; liersethPhrase_Common.add(Word.ZUN); liersethPhrase_Symbol.add(Symbol.ZUN); break; default: // UNDEFINED spellOldSchool = OldSchool.UNDEFINED; spellNewSchool = NewSchool.UNDEFINED; sourceKeu = Keu.UNDEFINED; liersethPhrase_Common.add(Word.UNDEFINED); liersethPhrase_Common.add(Word.UNDEFINED); liersethPhrase_Common.add(Word.UNDEFINED); liersethPhrase_Symbol.add(Symbol.UNDEFINED); liersethPhrase_Symbol.add(Symbol.UNDEFINED); liersethPhrase_Symbol.add(Symbol.UNDEFINED); break; } // The "Effect" will always end a Lierseth Phrase liersethPhrase_Common.add(Word.EFFECT); liersethPhrase_Symbol.add(Symbol.EFFECT); // Check if spell is Pure if (spellCode.charAt(0) == 'p') { this.elementChar = 1; this.schoolChar = 2; } // Inspect elementChar of spellCode, assign spellElement, elemental Word/Symbol, and // backgroundImage switch (spellCode.charAt(elementChar)) { case 'e' | 'E': spellElement = Element.EARTH; destinationKeu = Keu.KEUNA; liersethPhrase_Common.add(2, Word.URDT); liersethPhrase_Symbol.add(2, Symbol.URDT); break; case 'a' | 'A': spellElement = Element.AIR; destinationKeu = Keu.SEYLIN; liersethPhrase_Common.add(2, Word.FETT); liersethPhrase_Symbol.add(2, Symbol.FETT); break; case 'f' | 'F': spellElement = Element.FIRE; destinationKeu = Keu.BUUSIN; liersethPhrase_Common.add(2, Word.MOL); liersethPhrase_Symbol.add(2, Symbol.MOL); break; case 'w' | 'W': spellElement = Element.WATER; destinationKeu = Keu.HIECIN; liersethPhrase_Common.add(2, Word.MIRN); liersethPhrase_Symbol.add(2, Symbol.MIRN); break; case 'n' | 'N': spellElement = Element.NEXUS; destinationKeu = Keu.BIRSIN; liersethPhrase_Common.add(2, Word.ZEWE); liersethPhrase_Symbol.add(2, Symbol.ZEWE); break; case 'v' | 'V': spellElement = Element.VOID; destinationKeu = Keu.EDEN; liersethPhrase_Common.add(2, Word.THEIT); liersethPhrase_Symbol.add(2, Symbol.THEIT); break; default: // UNDEFINED spellElement = Element.UNDEFINED; destinationKeu = Keu.UNDEFINED; liersethPhrase_Common.add(2, Word.UNDEFINED); liersethPhrase_Symbol.add(2, Symbol.UNDEFINED); break; } // Inspect schoolChar of spellCode, assign spellCircle switch (spellCode.charAt(schoolChar)) { case '1': if (schoolChar == 1) spellCircle = Circle.FIRST; else // schoolChar == 2 spellCircle = Circle.PURE_FIRST; break; case '2': if (schoolChar == 1) spellCircle = Circle.SECOND; else // schoolChar == 2 spellCircle = Circle.PURE_SECOND; break; case '3': if (schoolChar == 1) spellCircle = Circle.THIRD; else // schoolChar == 2 spellCircle = Circle.PURE_THIRD; break; case '4': if (schoolChar == 1) spellCircle = Circle.FOURTH; else // schoolChar == 2 spellCircle = Circle.PURE_FIRST; break; case '5': if (schoolChar == 1) spellCircle = Circle.FIFTH; else // schoolChar == 2 spellCircle = Circle.PURE_FIFTH; break; case '6': if (schoolChar == 1) spellCircle = Circle.SIXTH; else // schoolChar == 2 spellCircle = Circle.PURE_SIXTH; break; case '7': // Insert extra words for Breath Spell if (schoolChar == 1) spellCircle = Circle.SEVENTH; else // schoolChar == 2 spellCircle = Circle.PURE_SEVENTH; liersethPhrase_Common.add(1, Word.O); liersethPhrase_Common.add(2, Word.LILIN); liersethPhrase_Common.add(3, Word.ANOTHO); liersethPhrase_Common.add(4, Word.SEYANRYN); liersethPhrase_Common.add(5, Word.UNDEFINED); liersethPhrase_Symbol.add(1, Symbol.O); liersethPhrase_Symbol.add(2, Symbol.LILIN); liersethPhrase_Symbol.add(3, Symbol.ANOTHO); liersethPhrase_Symbol.add(4, Symbol.SEYANRYN); liersethPhrase_Symbol.add(5, Symbol.UNDEFINED); break; default: // UNDEFINED spellCircle = Circle.UNDEFINED; break; } // Assign backgroundImages if (sourceKeu == sourceKeu.UNDEFINED | destinationKeu == destinationKeu.UNDEFINED) { backgroundImageFull = null; System.err.println("Keus not found!" + "\nSourceKeu = " + sourceKeu.toString().toLowerCase() + "\nDestinationKeu = " + destinationKeu.toString().toLowerCase()); } else { try { String resourceLocation = "resources/" + sourceKeu.toString().toLowerCase() + destinationKeu.toString().toLowerCase(); String imageFullURL = this.getClass().getResource(resourceLocation + ".png").toString() .toLowerCase(); backgroundImageFull = Image.getInstance(imageFullURL); backgroundImageFull.setAlignment(Image.MIDDLE | Image.UNDERLYING); backgroundImageFull.scaleAbsolute(594, 378); } catch (Exception ex) { System.err.println(ex + "\nImages for " + sourceKeu.toString() + destinationKeu.toString() + " were not found."); } } }
From source file:com.sapito.pdf.PDFView.PDFGeneratorActivosFijos.java
public void crearPDFInversion(HttpServletResponse hsr1, ArrayList<HashMap> resultados, double granTotalDepActual, double granTotalValorActual, double granTotalValorOr) throws Exception { Document dcmntaf = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(dcmntaf, baos); System.out.println(resultados.get(0).size()); dcmntaf.open();/* w w w . j a v a 2s . com*/ dcmntaf.open(); dcmntaf.addTitle("Sapito PDFs"); dcmntaf.addSubject("Pdf de sapito"); //------------------------ TAIS ______________________________ Image tais = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/tais-banner.jpg")); dcmntaf.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); dcmntaf.add(body); //------------------------------------------------------------------------------------------- Image footer = Image.getInstance(new URL("http://localhost:8080/SAPITO/resources/img/footer.jpg")); footer.setAbsolutePosition(50, 20); dcmntaf.add(footer); //---------------------- TITLE --------------------------- String titulo = "Reporte de Inversin"; //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); String titulo2 = "Reporte de Activos Fijos por Tipo"; //Cambiar el titulo del PDF aqui Font f2 = new Font(FontFamily.HELVETICA, 12.0f, Font.NORMAL, BaseColor.BLACK); Chunk c2 = new Chunk(titulo2 + " \n ", f2); c2.setBackground(BaseColor.WHITE); Paragraph title2 = new Paragraph(c2); title2.setAlignment(Element.ALIGN_LEFT); title2.setIndentationLeft(50); //------------------------- CONTENIDO ------------------------------------------------------- dcmntaf.add(title); //Titulo del PDF dcmntaf.add(title2); PdfPTable table = new PdfPTable(4); // PdfPCell cell; // cell = new PdfPCell(new Phrase("Tipo de A", FontFactory.getFont("TIMES_ROMAN", 12, Font.BOLD, BaseColor.BLACK))); // table.addCell(cell); table.addCell("Tipo de Activo fijo"); table.addCell("Valor Original"); table.addCell("Depreciacin Actual "); table.addCell("Valor Actual"); // Iterator it = resultados.get(0).entrySet().iterator(); for (int i = 0; i < resultados.size(); i++) { table.addCell(resultados.get(i).get("tipo").toString()); table.addCell(resultados.get(i).get("valorOriginal").toString()); table.addCell(resultados.get(i).get("depreciacionActual").toString()); table.addCell(resultados.get(i).get("valoreActual").toString()); } // while (it.hasNext()) { // Map.Entry e = (Map.Entry) it.next(); // System.out.println(e.getKey() + " " + e.getValue()); // // table.addCell(e.getValue().toString()); // } dcmntaf.add(table); String titulo3 = "Reporte Total de Activos Fijos"; //Cambiar el titulo del PDF aqui Font f3 = new Font(FontFamily.HELVETICA, 12.0f, Font.NORMAL, BaseColor.BLACK); Chunk c3 = new Chunk(titulo3 + " \n ", f3); c3.setBackground(BaseColor.WHITE); Paragraph title3 = new Paragraph(c3); title3.setAlignment(Element.ALIGN_LEFT); title3.setIndentationLeft(50); dcmntaf.add(title3); PdfPTable table2 = new PdfPTable(3); // PdfPCell cell; // cell = new PdfPCell(new Phrase("Tipo de A", FontFactory.getFont("TIMES_ROMAN", 12, Font.BOLD, BaseColor.BLACK))); // table.addCell(cell); table2.addCell("Valor Original Total"); table2.addCell("Depreciacin Anual Total"); table2.addCell("Valor Total"); table2.addCell(granTotalValorOr + ""); table2.addCell(granTotalDepActual + ""); table2.addCell(granTotalValorActual + ""); dcmntaf.add(table2); PdfPTable table3 = new PdfPTable(1); table3.setWidthPercentage(100.0f); table3.setWidths(new float[] { 2.0f }); table3.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("Resultado", font)); table3.addCell(cell); Depreciacion dep = new Depreciacion(); String bla = a + " "; table3.addCell(bla); //-------------------------- FIN CONTENIDO ----------------- dcmntaf.close(); dcmntaf.close(); byte[] bytes = baos.toByteArray(); hsr1.setContentType("application/pdf"); hsr1.setContentLength(bytes.length); hsr1.getOutputStream().write(bytes); }
From source file:com.sapito.pdf.PDFView.PDFGeneratorContabilidad.java
public void crearEstadoResultados(HttpServletResponse hsr1, String ingresos, String cVenta, String cGeneral, String cImpu, String cImpTot) throws Exception { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open();//from w w w . j av a2 s . co m document.addTitle("Sapito PDFs"); document.addSubject("Pdf de sapito"); //------------------------ 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 = "Estado de Resultados"; //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 PdfPTable table = new PdfPTable(2); table.addCell("Ingresos"); table.addCell(ingresos);//valor table.addCell("Costo de Venta"); table.addCell(cVenta);//valor table.addCell("Costos Generales"); table.addCell(cGeneral);//valor table.addCell("Impuestos de Ingresos"); table.addCell(cImpu);//valor table.addCell("Impuesto de Costos Totales"); table.addCell(cImpTot);//valor document.add(table); 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.PDFGeneratorContabilidad.java
public void crearVariacionContable(HttpServletResponse hsr1, String sInicial, String aumento, String utilidad, String disminucion, String perdidas, String sFinal) throws Exception { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open();// w w w.ja v a 2 s .co m document.addTitle("Sapito PDFs"); document.addSubject("Pdf de sapito"); //------------------------ 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 = "Variaciones de Capital Contable"; //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 PdfPTable table = new PdfPTable(2); table.addCell("Saldo al inicio del ejercicio"); table.addCell(sInicial);//valor table.addCell("Aumentos"); table.addCell(aumento);//valor table.addCell("Utilidades"); table.addCell(utilidad);//valor table.addCell("Disminuciones"); table.addCell(disminucion);//valor table.addCell("Perdidas"); table.addCell(perdidas);//valor table.addCell("Saldo al final del ejercicio"); table.addCell(sFinal);//valor document.add(table); 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.PDFGeneratorContabilidad.java
public void crearFlujo(HttpServletResponse hsr1, String operacion, String sInicio, String sFin) throws Exception { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open();//from ww w . j a va2 s .c o m document.addTitle("Sapito PDFs"); document.addSubject("Pdf de sapito"); //------------------------ 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 = "Flujo de Efectivo"; //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 PdfPTable table = new PdfPTable(2); table.addCell("Operacin"); table.addCell(operacion);//valor table.addCell("Saldo al inicio del ao"); table.addCell(sInicio);//valor table.addCell("Saldo al inicio del ao"); table.addCell(sFin);//valor document.add(table); 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.PDFGeneratorContabilidad.java
public void crearBalance(HttpServletResponse hsr1, String aCirculante, String aNCirculante, String tActivos, String pasivo) throws Exception { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open();//from w w w . j a v a 2 s. c o m document.addTitle("Sapito PDFs"); document.addSubject("Pdf de sapito"); //------------------------ 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 = "Balance General"; //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 PdfPTable table = new PdfPTable(2); table.addCell("Activo circulante"); table.addCell(aCirculante);//valor table.addCell("Activo no circulante"); table.addCell(aNCirculante);//valor table.addCell("total activos"); table.addCell(tActivos);//valor table.addCell("pasivo"); table.addCell(pasivo);//valor document.add(table); 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 crearPDFFactura(Map<String, Object> model, HttpServletResponse hsr1, List<Producto> tipo) throws Exception { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open();/*ww w.jav a2 s . co 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 Ventas"; //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 table3 = new PdfPTable(3); table3.setWidthPercentage(100.0f); table3.setWidths(new float[] { 2.0f, 2.0f, 2.0f }); table3.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("Nombre", font)); table3.addCell(cell); cell.setPhrase(new Phrase("Categoria", font)); table3.addCell(cell); cell.setPhrase(new Phrase("Marca", font)); table3.addCell(cell); Depreciacion dep = new Depreciacion(); for (int i = 0; i < tipo.size(); i++) { //a = dep.getResultado(); //b = dep.getValorADep(); table3.addCell(tipo.get(i).getNombreProducto()); table3.addCell(tipo.get(i).getCategoria()); table3.addCell(tipo.get(i).getMarca()); } // String bla = a + " "; // String bl = b + " "; // table3.addCell(bla); // table3.addCell(bl); document.add(table3); //-------------------------- 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 reporteventa(Map<String, Object> model, HttpServletResponse hsr1, List<OrdenVenta> ordenventa) throws Exception { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open();//from w w w. j av a2 s.co 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 Ventas"; //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 ventas en el dia", font)); table.addCell(cell); for (int i = 0; i < ordenventa.size(); i++) { a = ordenventa.get(i).getMontoConCargos(); 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 reportecompras(Map<String, Object> model, HttpServletResponse hsr1, List<OrdenCompra> ordenCompra) throws Exception { Document document = new Document(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PdfWriter.getInstance(document, baos); document.open();/*from w ww .ja va2 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 Compras"; //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 Compras en el dia", font)); table.addCell(cell); for (int i = 0; i < ordenCompra.size(); i++) { a = ordenCompra.get(i).getCostoTotal(); 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 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();/* w ww . ja v a2s . c om*/ 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); }