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:EmployeeInfo.java
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed String value1 = txt_empID.getText(); String value2 = txt_firstName.getText(); String value3 = txt_lastName.getText(); String value4 = txt_age.getText(); try {/*from w w w . j av a 2s .c om*/ Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("Report1.pdf")); document.open(); //add barcode PdfContentByte CB = writer.getDirectContent(); BarcodeEAN codEAN = new BarcodeEAN(); codEAN.setCode("1234567891023"); //this value must be 13 digits Paragraph para = new Paragraph(); document.add(new Paragraph("Barcode UDCA")); codEAN.setCodeType(BarcodeEAN.UPCA); codEAN.setCode("1098765432112"); document.add(codEAN.createImageWithBarcode(CB, BaseColor.BLACK, BaseColor.BLACK)); document.add(para); Image image = Image.getInstance("images/Cherry.png"); document.add(new Paragraph("Image")); document.add(image); // write tile with style document.add(new Paragraph("Hello World", FontFactory.getFont(FontFactory.TIMES_BOLD, 18, Font.BOLD, BaseColor.RED))); // write date document.add(new Paragraph(new Date().toString())); document.add(new Paragraph("--------------------------------------------")); PdfPTable table = new PdfPTable(2);// 2 columns // set title , column sapn, aliignment,background color PdfPCell cell = new PdfPCell(new Paragraph("Title")); cell.setColspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.BLUE); table.addCell(cell); // PdfPTable table = new PdfPTable(x); should add multiple of x table.addCell("EmployeeID"); table.addCell(value1); table.addCell("Name"); table.addCell(value2); table.addCell("Last Name"); table.addCell(value3); table.addCell("Age"); table.addCell(value4); document.add(table); List list = new List(true, 20); list.add("First Item"); list.add("Second Item"); list.add("Third Item"); list.add("Fourth Item"); document.add(list); document.close(); JOptionPane.showMessageDialog(null, "Report saved"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e); } }
From source file:application.OfferWindow_Controller.java
@SuppressWarnings("deprecation") public void angebot_erstellen() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException, FileNotFoundException, DocumentException { idangebot++;//from w w w .j ava 2s. co m fikusString = fikusText.getText(); perkusidtext = Integer.parseInt(perkusid.getText()); standortnametext = standortname.getText(); rabatttext = Integer.parseInt(rabatt.getText()); mengetext = Integer.parseInt(menge.getText()); gueltigkeit = Date.valueOf(todayplus30); java.sql.Connection conn = Connection.connecten(); String query3 = "SELECT * FROM Perkus WHERE idPerkus='" + perkusnametext + "'"; PreparedStatement stmt3 = conn.prepareStatement(query3); ResultSet set = stmt3.executeQuery(); while (set.next()) { customer = new PeopleCustomers(idangebot, set.getString(2), query3, query3, query3, query3, query3, query3, query3, query3, query3, query3, idangebot, idangebot); } String perkusnametext = customer.getname(); int idPerkus = perkusidtext; // PDF create step 1 // Using a custom page size /** Path to the resulting PDF file. */ final String RESULT = "./Offer_" + perkusnametext + ".pdf"; // step 2 PdfWriter.getInstance(document, new FileOutputStream(RESULT)); ; // step 3 document.open(); document.addTitle("Offer"); document.addCreationDate(); document.add(new Paragraph( "Created: " + today.getDayOfMonth() + "." + today.getMonthValue() + "." + today.getYear(), new Font(Font.FontFamily.HELVETICA, 9, Font.ITALIC))); document.add(new Paragraph(" ")); // step 4 document.add(new Paragraph("Sample Company", new Font(Font.FontFamily.HELVETICA, 9, Font.BOLD))); document.add(new Paragraph("Street House No.", new Font(Font.FontFamily.HELVETICA, 9))); document.add(new Paragraph("D-12345 City", new Font(Font.FontFamily.HELVETICA, 9))); document.add(new Paragraph("Telephone: 069-12345678, Fax: 069-23456789", new Font(Font.FontFamily.HELVETICA, 9))); document.add(new Paragraph("E-Mail: sampleCompany@email.de", new Font(Font.FontFamily.HELVETICA, 9))); document.add(new Paragraph("http://www.sampleCompany.de", new Font(Font.FontFamily.HELVETICA, 9))); document.add(new Paragraph(" ")); Paragraph paragraph = new Paragraph("To Customer:", new Font(Font.FontFamily.HELVETICA, 10, Font.BOLD)); document.add(paragraph); document.add(new Paragraph("People Customer: " + fikusnametext, new Font(Font.FontFamily.HELVETICA, 9))); document.add( new Paragraph("Corporate Customer: " + perkusnametext, new Font(Font.FontFamily.HELVETICA, 9))); document.add(new Paragraph("Location: " + standortnametext, new Font(Font.FontFamily.HELVETICA, 9))); document.add(new Paragraph(" ")); Paragraph paragraph1 = new Paragraph("Offer " + idangebot, new Font(Font.FontFamily.HELVETICA, 20, Font.BOLDITALIC, BaseColor.BLUE)); document.add(paragraph1); document.add(new Paragraph(" ")); document.add(new Paragraph("Dear Sir or Madam, \n" + "attached you receive the following offer: \n", new Font(Font.FontFamily.HELVETICA, 13, Font.ITALIC))); document.add(new Paragraph(" ")); postion_hinzufuegen(); float preistextRabatt = erstesprodukt + zweitesprodukt; document.add(new Paragraph("Total price with discount: " + f.format(preistextRabatt) + "EUR", new Font(Font.FontFamily.HELVETICA, 15, Font.BOLD, BaseColor.BLUE))); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); if (size >= 2) { document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); document.add(new Paragraph(" ")); } document.add(new Paragraph( "Terms and Conditions:, \n" + "- The Sample Company license terms are valid. \n" + "- All prices are quoted in addition of sales tax.\n" + "- Payment follows 30 days net. This offer is non-binding and is valid until " + +todayplus30.getDayOfMonth() + "." + todayplus30.getMonthValue() + "." + today.getYear(), new Font(Font.FontFamily.HELVETICA, 11, Font.ITALIC))); document.add(new Paragraph(" ")); document.add(new Paragraph("With kind regards,", new Font(Font.FontFamily.HELVETICA, 13))); document.add(new Paragraph("Sample Company", new Font(Font.FontFamily.HELVETICA, 13))); document.add(new Paragraph("Sample Company employee", new Font(Font.FontFamily.HELVETICA, 13))); // step 5 document.close(); Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("Information"); alert.setHeaderText(null); alert.setContentText("The Offer PDF has been created!"); alert.showAndWait(); String query7 = "INSERT INTO Angebot(idAngebot,Produktname,Gesamtpreis,Rabatt,gueltig_bis,Perkus_idPerkus)" + "values('" + idangebot + "','" + produktnametext + "','" + preistextRabatt + "','" + rabatttext + "','" + gueltigkeit + "','" + idPerkus + "')"; PreparedStatement stmt7 = conn.prepareStatement(query7); stmt7.executeUpdate(); }
From source file:br.com.ifrn.panfleto.gui.PainelCadastrar.java
public BaseColor corPagina() { if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Branco")) { return BaseColor.WHITE; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Preto")) { return BaseColor.BLACK; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Azul")) { return BaseColor.BLUE; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cinza Escuro")) { return BaseColor.DARK_GRAY; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cinza")) { return BaseColor.GRAY; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cinza Claro")) { return BaseColor.LIGHT_GRAY; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Magenta")) { return BaseColor.MAGENTA; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Laranja")) { return BaseColor.ORANGE; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Rosa")) { return BaseColor.PINK; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Vermlho")) { return BaseColor.RED; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Amarero")) { return BaseColor.YELLOW; } else if (comboxSelecionarCorPainelGerarPdf.getSelectedItem().equals("Cyan")) { return BaseColor.CYAN; }// ww w . j a va 2s. co m return BaseColor.WHITE; }
From source file:bsf.conn.DBMS.java
private static void addTitlePage(Document document) throws DocumentException { Paragraph preface = new Paragraph(); // We add one empty line addEmptyLine(preface, 1);//www.j a va 2s . c om // Lets write a big header catFont.setColor(BaseColor.BLUE); preface.add(new Paragraph("BSF DATABASE", catFont)); addEmptyLine(preface, 1); // Will create: Report generated by: _name, _date preface.add(new Paragraph( "Report generated by: " + System.getProperty("user.name") + ", " + new java.util.Date(), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ smallBold)); addEmptyLine(preface, 3); preface.add(new Paragraph("This document gives Database of BSF ", smallBold)); addEmptyLine(preface, 20); preface.add(new Paragraph("@copyright BSF", redFont)); document.add(preface); // Start a new page document.newPage(); }
From source file:classes.utils.crearPDF_Depreciacion.java
public String writePDF(String datos, Scene scene) throws FileNotFoundException, DocumentException, BadElementException, IOException { javafx.scene.control.TextField projectName = (TextField) scene.lookup(CNodeID.TEXTFIELD_PROJECT_NAME); String project = projectName.getText(); StringTokenizer st = new StringTokenizer(datos, "_"); principal = st.nextToken();//w w w. j ava 2 s . c o m salvageV = st.nextToken(); period = st.nextToken(); tax = st.nextToken(); periodSalvage = st.nextToken(); category = st.nextToken(); data = st.nextToken(); Document document = new Document(PageSize.LETTER, 80, 80, 50, 50); FileOutputStream salida = new FileOutputStream(project + "_depreciation.pdf"); PdfWriter writer = PdfWriter.getInstance(document, salida); writer.setInitialLeading(0); Paragraph paragraph = new Paragraph(); paragraph.setFont(new Font(FontFactory.getFont("Courier", 20, Font.BOLDITALIC, BaseColor.RED))); paragraph.add("\n\n\nDEPRECIACION"); paragraph.setAlignment(Paragraph.ALIGN_CENTER); //System.out.println(getClass().getResource("images/logo_report.png")); //Image image = Image.getInstance("/home/isaac/IdeaProjects/ProjectEvaluation/src/images/logo_report.png"); //image.scaleToFit(150, 150); Image image1 = Image.getInstance(project + "/" + project + "_DEP_TY.png"); image1.scaleToFit(300, 300); //image.setAlignment(Chunk.ALIGN_RIGHT); image1.setAlignment(Chunk.ALIGN_CENTER); Paragraph paragraph_2 = new Paragraph(); paragraph_2.setFont(new Font(FontFactory.getFont("Courier", 12, Font.BOLD, BaseColor.BLUE))); paragraph_2.add( "\n\n\n\n\n\n\n\n\n\n\nADMINISTRACION Y EVALUACION DE PROYECTOS\n\n SERGIO VALDES TORRES A01365520\n ERIK MARTIN A01365096\nISAAC SECUNDINO A01361162\n IVAN CABRER A01184937"); paragraph_2.setAlignment(Paragraph.ALIGN_RIGHT); Paragraph paragraph_3 = new Paragraph(); paragraph_3.setFont(new Font(FontFactory.getFont("Courier", 11, Font.BOLD, BaseColor.BLACK))); paragraph_3.add("\n " + data); paragraph_3.setAlignment(Paragraph.ALIGN_LEFT); Paragraph paragraph_5 = new Paragraph(); paragraph_5.setFont(new Font(FontFactory.getFont("Courier", 6, Font.BOLD, BaseColor.BLUE))); paragraph_5.add("\n\nP DEPRECIATON RATE ANNUAL DEPRECIATON CUMMULATIVE DEPRECIATON VALUE IN LEDGERS "); paragraph_5.setAlignment(Paragraph.ALIGN_LEFT); Paragraph paragraph_4 = new Paragraph(); paragraph_4.setFont(new Font(FontFactory.getFont("Courier", 9, Font.BOLD, BaseColor.BLACK))); paragraph_4.add("Nombre del Evaluador: \n Principal: " + principal + " \n Salvag Value: " + salvageV + " \n Numero de Periodos: " + period + "\n Tax: " + tax + " \n Salvage Period: " + periodSalvage + "\n Categoria: " + category); paragraph_4.setAlignment(Paragraph.ALIGN_LEFT); Paragraph paragraph_6 = new Paragraph(); paragraph_6.setFont(new Font(FontFactory.getFont("Courier", 15, Font.BOLD, BaseColor.GRAY))); paragraph_6.add("\n GRAFICAS\n"); paragraph_6.setAlignment(Paragraph.ALIGN_CENTER); document.open(); //document.add(image); document.add(paragraph); document.add(paragraph_4); document.add(paragraph_5); document.add(paragraph_3); document.add(paragraph_6); Image image2 = Image.getInstance(project + "/" + project + "_DEP_DR.png"); Image image3 = Image.getInstance(project + "/" + project + "_DEP_AD.png"); Image image4 = Image.getInstance(project + "/" + project + "_DEP_ACD.png"); Image image5 = Image.getInstance(project + "/" + project + "_DEP_LV.png"); document.add(image2); document.add(image3); document.add(image4); document.add(image5); document.add(image1); document.add(paragraph_2); document.close(); return null; }
From source file:classes.utils.createPDF_checkList.java
public String writePDF(Scene scene, String datos) throws FileNotFoundException, DocumentException, BadElementException, IOException { javafx.scene.control.TextField projectName = (javafx.scene.control.TextField) scene .lookup(CNodeID.TEXTFIELD_PROJECT_NAME); String project = projectName.getText(); StringTokenizer st = new StringTokenizer(datos, "*"); dato1 = st.nextToken();//w w w .j a v a 2 s . c om dato2 = st.nextToken(); dato3 = st.nextToken(); dato4 = st.nextToken(); dato5 = st.nextToken(); dato6 = st.nextToken(); dato7 = st.nextToken(); dato8 = st.nextToken(); dato9 = st.nextToken(); dato10 = st.nextToken(); dato11 = st.nextToken(); dato12 = st.nextToken(); dato13 = st.nextToken(); dato14 = st.nextToken(); dato15 = st.nextToken(); dato16 = st.nextToken(); dato17 = st.nextToken(); Document document = new Document(PageSize.LETTER, 80, 80, 50, 50); FileOutputStream salida = new FileOutputStream(project + "_CheckList.pdf"); PdfWriter writer = PdfWriter.getInstance(document, salida); writer.setInitialLeading(0); Paragraph paragraph = new Paragraph(); paragraph.setFont(new Font(FontFactory.getFont("Courier", 20, Font.BOLDITALIC, BaseColor.RED))); paragraph.add("\n\n\nCHECK LIST"); paragraph.setAlignment(Paragraph.ALIGN_CENTER); //Image image = Image.getInstance("/home/isaac/IdeaProjects/ProjectEvaluation/src/images/logo_report.png"); //image.scaleToFit(150, 150); //image.setAlignment(Chunk.ALIGN_RIGHT); Paragraph paragraph_2 = new Paragraph(); paragraph_2.setFont(new Font(FontFactory.getFont("Courier", 12, Font.BOLD, BaseColor.BLUE))); paragraph_2.add( "\n\n\n\n\n\n\nADMINISTRACION Y EVALUACION DE PROYECTOS\n\n SERGIO VALDES TORRES A01365520\n ERIK MARTIN A01365096\nISAAC SECUNDINO A01361162\n IVAN CABRER A01184937"); paragraph_2.setAlignment(Paragraph.ALIGN_RIGHT); Paragraph paragraph_4 = new Paragraph(); paragraph_4.setFont(new Font(FontFactory.getFont("Courier", 6, Font.BOLD, BaseColor.BLACK))); paragraph_4.add("Strategy---Alignment What specific organization strategy does this project align with?" + " " + dato1 + "\n" + "Driver---What business problem does the project solve?" + " " + dato2 + "\n" + "Success Metrics---How will measure success?" + " " + dato3 + "\n" + "Sponsorship---Who is the project sponsor?" + " " + dato4 + "\n" + "Risk---What is the impact of not doing this project?" + " " + dato5 + "\n" + "Risk---What is the project risk to our organization?" + " " + dato6 + "\n" + "Risk---Where does the proposed project fit in our risk profile?" + " " + dato7 + "\n" + "Benefits, value---What is the value of the project organization?" + " " + dato8 + "\n" + "Benefits, value---When will the project shows results?" + " " + dato9 + "\n" + "Objectives---What are the project objectives?" + " " + dato10 + "\n" + "Organization Culture---Is our organization culture right for this type of project?" + " " + dato11 + "\n" + "Resources---Will internal resources be available for this project?" + " " + dato12 + "\n" + "Approach---Will we build or buy?" + " " + dato13 + "\n" + "Schedule---How long will this project take?" + " " + dato14 + "\n" + "Schedule---Is the timeline realistic?" + " " + dato15 + "\n" + "Training/Resources---Will staff training be required?" + " " + dato16 + "\n" + "Finance/Portfolio---What is the estimated cost of the project?" + " " + dato17 + "\n"); /*+ "Portfolio---Is this a new initiative or path of an existing initiative?"+" "+dato18+"\n" + "Portfolio---How does this project interact with current projects?"+" "+dato19+"\n" + "Technology---Is the technology available or new?"+" "+dato20+""); */ paragraph_4.setAlignment(Paragraph.ALIGN_LEFT); document.open(); //document.add(image); document.add(paragraph); document.add(paragraph_4); document.add(paragraph_2); document.close(); return "pdf Creado"; }
From source file:classes.utils.createPDF_NetPresent.java
public String writePDF(Scene scene, String datos) throws FileNotFoundException, DocumentException, BadElementException, IOException { javafx.scene.control.TextField projectName = (javafx.scene.control.TextField) scene .lookup(CNodeID.TEXTFIELD_PROJECT_NAME); String project = projectName.getText(); StringTokenizer st = new StringTokenizer(datos, "_"); period = st.nextToken();/*from ww w. ja v a2 s. co m*/ principal = st.nextToken(); interestRate = st.nextToken(); tax = st.nextToken(); salvageV = st.nextToken(); periodSalvage = st.nextToken(); data = st.nextToken(); Document document = new Document(PageSize.LETTER, 80, 80, 50, 50); FileOutputStream salida = new FileOutputStream(project + "_NetPresentValue.pdf"); PdfWriter writer = PdfWriter.getInstance(document, salida); writer.setInitialLeading(0); Paragraph paragraph = new Paragraph(); paragraph.setFont(new Font(FontFactory.getFont("Courier", 20, Font.BOLDITALIC, BaseColor.RED))); paragraph.add("\n\n\nNET PRESENT VALUE"); paragraph.setAlignment(Paragraph.ALIGN_CENTER); //Image image = Image.getInstance("/home/isaac/IdeaProjects/ProjectEvaluation/src/images/logo_report.png"); //image.scaleToFit(150, 150); Image image1 = Image.getInstance(project + "/" + project + "_NPV_CCF.png"); image1.scaleToFit(300, 300); //image.setAlignment(Chunk.ALIGN_RIGHT); image1.setAlignment(Chunk.ALIGN_CENTER); Paragraph paragraph_2 = new Paragraph(); paragraph_2.setFont(new Font(FontFactory.getFont("Courier", 12, Font.BOLD, BaseColor.BLUE))); paragraph_2.add( "\n\n\n\n\n\n\n\n\n\n\nADMINISTRACION Y EVALUACION DE PROYECTOS\n\n SERGIO VALDES TORRES A01365520\n ERIK MARTIN A01365096\nISAAC SECUNDINO A01361162\n IVAN CABRER A01184937"); paragraph_2.setAlignment(Paragraph.ALIGN_RIGHT); Paragraph paragraph_3 = new Paragraph(); paragraph_3.setFont(new Font(FontFactory.getFont("Courier", 11, Font.BOLD, BaseColor.BLACK))); paragraph_3.add("\n " + data); paragraph_3.setAlignment(Paragraph.ALIGN_LEFT); Paragraph paragraph_5 = new Paragraph(); paragraph_5.setFont(new Font(FontFactory.getFont("Courier", 10, Font.BOLD, BaseColor.BLUE))); paragraph_5.add("\n\nP OUTFLOW INFLOW NET CASH FLOW CUMULATIVE CASH "); paragraph_5.setAlignment(Paragraph.ALIGN_LEFT); Paragraph paragraph_4 = new Paragraph(); paragraph_4.setFont(new Font(FontFactory.getFont("Courier", 9, Font.BOLD, BaseColor.BLACK))); paragraph_4.add("Nombre del Evaluador: \nPeriods: " + period + "\n Principal: " + principal + " \n Interest Rate%: " + interestRate + " \n Tax Rate %: " + tax + "\n Salvage Value: " + salvageV + " \n Period SV: " + periodSalvage); paragraph_4.setAlignment(Paragraph.ALIGN_LEFT); Paragraph paragraph_6 = new Paragraph(); paragraph_6.setFont(new Font(FontFactory.getFont("Courier", 15, Font.BOLD, BaseColor.GRAY))); paragraph_6.add("\n GRAFICAS\n"); paragraph_6.setAlignment(Paragraph.ALIGN_CENTER); document.open(); //document.add(image); document.add(paragraph); document.add(paragraph_4); document.add(paragraph_5); document.add(paragraph_3); document.add(paragraph_6); document.add(image1); Image image2 = Image.getInstance(project + "/" + project + "_NPV_NCF.png"); document.add(image2); document.add(paragraph_2); document.close(); return null; }
From source file:classes.utils.createPDF_PayBack.java
public String writePDF(Scene scene, String datos) throws FileNotFoundException, DocumentException, BadElementException, IOException { javafx.scene.control.TextField projectName = (javafx.scene.control.TextField) scene .lookup(CNodeID.TEXTFIELD_PROJECT_NAME); String project = projectName.getText(); StringTokenizer st = new StringTokenizer(datos, "_"); period = st.nextToken();/*from www . jav a2 s. c om*/ principal = st.nextToken(); interestRate = st.nextToken(); data = st.nextToken(); Document document = new Document(PageSize.LETTER, 80, 80, 50, 50); FileOutputStream salida = new FileOutputStream(project + "_PayBackPeriod.pdf"); PdfWriter writer = PdfWriter.getInstance(document, salida); writer.setInitialLeading(0); Paragraph paragraph = new Paragraph(); paragraph.setFont(new Font(FontFactory.getFont("Courier", 20, Font.BOLDITALIC, BaseColor.RED))); paragraph.add("\n\n\nPAYBACK PERIOD"); paragraph.setAlignment(Paragraph.ALIGN_CENTER); // TODO: Change absolute to relative //Image image = Image.getInstance("/home/isaac/IdeaProjects/ProjectEvaluation/src/images/logo_report.png"); //image.scaleToFit(150, 150); Image image1 = Image.getInstance(project + "/" + project + "_PBP_CCF.png"); image1.scaleToFit(300, 300); //image.setAlignment(Chunk.ALIGN_RIGHT); image1.setAlignment(Chunk.ALIGN_CENTER); Paragraph paragraph_2 = new Paragraph(); paragraph_2.setFont(new Font(FontFactory.getFont("Courier", 12, Font.BOLD, BaseColor.BLUE))); paragraph_2.add( "\n\n\n\n\n\n\n\n\n\n\nADMINISTRACION Y EVALUACION DE PROYECTOS\n\n SERGIO VALDES TORRES A01365520\n ERIK MARTIN A01365096\nISAAC SECUNDINO A01361162\n IVAN CABRER A01184937"); paragraph_2.setAlignment(Paragraph.ALIGN_RIGHT); Paragraph paragraph_3 = new Paragraph(); paragraph_3.setFont(new Font(FontFactory.getFont("Courier", 11, Font.BOLD, BaseColor.BLACK))); paragraph_3.add("\n " + data); paragraph_3.setAlignment(Paragraph.ALIGN_LEFT); Paragraph paragraph_5 = new Paragraph(); paragraph_5.setFont(new Font(FontFactory.getFont("Courier", 10, Font.BOLD, BaseColor.BLUE))); paragraph_5.add("\n\nP OUTFLOW INFLOW CUMMULATIVE CASH... "); paragraph_5.setAlignment(Paragraph.ALIGN_LEFT); Paragraph paragraph_4 = new Paragraph(); paragraph_4.setFont(new Font(FontFactory.getFont("Courier", 9, Font.BOLD, BaseColor.BLACK))); paragraph_4.add("Nombre del Evaluador: \n Principal: " + principal + " \n Numero de Periodos: " + period + "\nInterest Rate %" + interestRate); paragraph_4.setAlignment(Paragraph.ALIGN_LEFT); Paragraph paragraph_6 = new Paragraph(); paragraph_6.setFont(new Font(FontFactory.getFont("Courier", 15, Font.BOLD, BaseColor.GRAY))); paragraph_6.add("\n GRAFICAS\n"); paragraph_6.setAlignment(Paragraph.ALIGN_CENTER); document.open(); //document.add(image); document.add(paragraph); document.add(paragraph_4); document.add(paragraph_5); document.add(paragraph_3); document.add(paragraph_6); Image image2 = Image.getInstance(project + "/" + project + "_PBP_NCF.png"); document.add(image1); document.add(image2); document.add(paragraph_2); document.close(); return null; }
From source file:com.algoboss.erp.util.report.PDFExporter.java
License:Apache License
protected PdfPTable exportPDFTable(FacesContext context, DataTable table, boolean pageOnly, boolean selectionOnly, boolean filteredOnly, String encoding) { int columnsCount = getColumnsCount(table); PdfPTable pdfTable = new PdfPTable(columnsCount); this.cellFont = FontFactory.getFont(FontFactory.TIMES, encoding, 7, Font.NORMAL); this.facetFont = FontFactory.getFont(FontFactory.TIMES, encoding, 7, Font.BOLD, BaseColor.BLUE); this.facetBgColor = BaseColor.LIGHT_GRAY; addColumnFacets(table, pdfTable, ColumnType.HEADER); if (pageOnly) { exportPageOnly(context, table, pdfTable); } else if (selectionOnly) { exportSelectionOnly(context, table, pdfTable); } else if (filteredOnly) { exportFilteredOnly(context, table, pdfTable); } else {//w w w. j a v a2 s . co m exportAll(context, table, pdfTable); } if (table.hasFooterColumn()) { addColumnFacets(table, pdfTable, ColumnType.FOOTER); } table.setRowIndex(-1); return pdfTable; }
From source file:com.automaster.autoview.server.servlet.TextStateOperators.java
/** * Creates a PDF document.//from w ww .j a v a 2 s . c om * @param filename the path to the new PDF document * @throws DocumentException * @throws IOException */ public void createPdf(String filename) throws IOException, DocumentException { // step 1 Rectangle rect = new Rectangle(595, 842); Document document = new Document(rect, 30, 30, 30, 30); // step 2 PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(filename)); // step 3 document.open(); // step 4 //PdfAcroForm canva = writer.getAcroForm(); BaseFont bf = BaseFont.createFont(); //canva.addMultiLineTextField("txtTeste", "texto de teste vamos ver se le quebra a linha", bf, 15, 300, 800, 100, 100); PdfContentByte canvas = writer.getDirectContent(); String text = "AWAY again"; String text1 = "TESTE Rua alameda luis de sousa santos, N 52, castanhal, CEP: 68742-783, ao lado do posto adriano"; canvas.beginText(); // line 1 canvas.setFontAndSize(bf, 16); canvas.moveText(36, 800); canvas.moveTextWithLeading(0, -24); canvas.setTextRise(10); canvas.showText(text); // line 2 canvas.setWordSpacing(20); canvas.newlineShowText(text); // line 3 canvas.setCharacterSpacing(10); canvas.newlineShowText(text); canvas.setWordSpacing(0); canvas.setCharacterSpacing(0); // line 4 canvas.setHorizontalScaling(50); canvas.newlineShowText(text); canvas.setHorizontalScaling(100); // line 5 canvas.newlineShowText(text); canvas.setTextRise(15); canvas.setFontAndSize(bf, 12); canvas.setColorFill(BaseColor.RED); canvas.showText("2"); canvas.setColorFill(GrayColor.GRAYBLACK); // line 6 canvas.setLeading(56); canvas.setMiterLimit(5); canvas.newlineShowText( "Rua alameda luis de sousa santos, N 52, castanhal, CEP: 68742-783, ao lado do posto" + text); canvas.setLeading(24); canvas.newlineText(); Paragraph paragraph = new Paragraph("teste"); PdfWriter pdfWriter = canvas.getPdfWriter(); PdfAcroForm pdfAcroForm = pdfWriter.getAcroForm(); //pdfAcroForm.addMultiLineTextField("txtTeste", "Changing the adriano leading: Rua alameda luis de sousa santos, N 52, castanhal, CEP: 68742-783, ao lado do posto", bf, 12, 30, 650, 550, 750); //pdfAcroForm.addHiddenField("txtTeste", text); PdfFormField pdfFormField = new PdfFormField(pdfWriter, 30, 650, 550, 750, null); pdfFormField.setFieldName("txtTeste"); pdfFormField.setValueAsString(text1); //TextField textField = new TextField(canvas.getPdfWriter(), new Rectangle(30, 650, 550, 750), "txtTest"); //textField.setText(text); pdfAcroForm.addFormField(pdfFormField); // line 7 PdfTextArray array = new PdfTextArray("A"); array.add(120); array.add("W"); array.add(120); array.add("A"); array.add(95); array.add("Y again"); canvas.showText(array); canvas.endText(); canvas.setColorFill(BaseColor.BLUE); canvas.beginText(); canvas.setTextMatrix(360, 770); canvas.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL); canvas.setFontAndSize(bf, 24); canvas.showText(text); canvas.endText(); canvas.beginText(); canvas.setTextMatrix(360, 730); canvas.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_STROKE); canvas.setFontAndSize(bf, 24); canvas.showText(text); canvas.endText(); canvas.beginText(); canvas.setTextMatrix(360, 690); canvas.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE); canvas.setFontAndSize(bf, 24); canvas.showText(text); canvas.endText(); canvas.beginText(); canvas.setTextMatrix(360, 650); canvas.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_INVISIBLE); canvas.setFontAndSize(bf, 24); canvas.showText(text); canvas.endText(); PdfTemplate template = canvas.createTemplate(200, 36); template.setLineWidth(2); for (int i = 0; i < 6; i++) { template.moveTo(0, i * 6); template.lineTo(200, i * 6); } template.stroke(); canvas.saveState(); canvas.beginText(); canvas.setTextMatrix(360, 610); canvas.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_CLIP); canvas.setFontAndSize(bf, 24); canvas.showText(text); canvas.endText(); canvas.addTemplate(template, 360, 610); canvas.restoreState(); canvas.saveState(); canvas.beginText(); canvas.setTextMatrix(360, 570); canvas.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_STROKE_CLIP); canvas.setFontAndSize(bf, 24); canvas.showText(text); canvas.endText(); canvas.addTemplate(template, 360, 570); canvas.restoreState(); canvas.saveState(); canvas.beginText(); canvas.setTextMatrix(360, 530); canvas.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE_CLIP); canvas.setFontAndSize(bf, 24); canvas.showText(text); canvas.endText(); canvas.addTemplate(template, 360, 530); canvas.restoreState(); canvas.saveState(); canvas.beginText(); canvas.setTextMatrix(360, 490); canvas.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_CLIP); canvas.setFontAndSize(bf, 24); canvas.showText(text); canvas.endText(); canvas.addTemplate(template, 360, 490); canvas.restoreState(); // step 5 //document.add((Element) pdfAcroForm); document.close(); }