List of usage examples for com.itextpdf.text Font Font
public Font(final FontFamily family, final float size)
From source file:fxml.test.PDFService.java
public PdfPTable createTableHeader(int start) { PdfPTable table = null;/*from w ww . j a va2 s .co m*/ try { int colCount = 1; List<Float> columnsList = new ArrayList<>(); columnsList.add(57.5f); columnsList.add(159.4f); for (int i = start; i < list.size(); i++) { if (list.get(i) instanceof Course) { columnsList.add(44f); } else if (list.get(i).equals("Total Credit")) { columnsList.add(30f); } else if (list.get(i).equals("Total GPA")) { columnsList.add(30f); } else if (list.get(i).equals("Letter Grade")) { columnsList.add(30f); } else if (list.get(i).equals("Cumulative")) { columnsList.add(88f); } else { columnsList.add(66f); } if (colCount == 12) { break; } colCount++; } float[] columns = new float[columnsList.size()]; for (int i = 0; i < columnsList.size(); i++) { columns[i] = columnsList.get(i); } table = new PdfPTable(columns.length); System.err.println("table size :" + table.getNumberOfColumns()); table.setHorizontalAlignment(Element.ALIGN_LEFT); table.setTotalWidth(columns); table.setLockedWidth(true); } catch (DocumentException ex) { Logger.getLogger(PDFService.class.getName()).log(Level.SEVERE, null, ex); } PdfPCell regCell = getCellForString("Reg No.", 0, true, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font9, false); regCell.setPaddingTop(0f); table.addCell(regCell); PdfPCell nameCell = getNameCell(); nameCell.setPaddingBottom(2f); table.addCell(nameCell); int colCount = 1; for (int i = start; i < list.size(); i++) { if (list.get(i) instanceof Course) { Course course = (Course) list.get(i); PdfPCell cell3 = new PdfPCell(createCourseInfo(course)); cell3.setPaddingTop(1f); cell3.setPaddingBottom(2f); //cell3.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell3); } else if (list.get(i).equals("Total Credit") || list.get(i).equals("Total GPA") || list.get(i).equals("Letter Grade")) { String str = (String) list.get(i); String s[] = str.split(" "); PdfPTable totalCredit = new PdfPTable(1); totalCredit.setSpacingBefore(12.5f); totalCredit.setWidthPercentage(100); totalCredit.getDefaultCell().setBorder(Rectangle.NO_BORDER); PdfPCell cell1 = getCellForString(s[0], 0, false, 0, Element.ALIGN_CENTER, new Font(Font.FontFamily.TIMES_ROMAN, 10f), false); PdfPCell cell2 = getCellForString(s[1], 0, false, 0, Element.ALIGN_CENTER, new Font(Font.FontFamily.TIMES_ROMAN, 10f), false); totalCredit.addCell(cell1); totalCredit.addCell(cell2); PdfPCell grade = new PdfPCell(totalCredit); table.addCell(grade); } else if (list.get(i).equals("Cumulative")) { PdfPTable cumulative = new PdfPTable(1); // cumulative.setPaddingTop(count); cumulative.addCell(getCellForString("Cumulative", 0, false, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font10, true)); PdfPTable creditGpaGrade = new PdfPTable(3); creditGpaGrade.setTotalWidth(88f); creditGpaGrade.setLockedWidth(true); creditGpaGrade.addCell(getCellForString("Credit", 0, false, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font10, true)); creditGpaGrade.addCell(getCellForString("GPA", 0, false, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font10, true)); creditGpaGrade.addCell(getCellForString("Grade", 0, false, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font10, true)); PdfPTable p = new PdfPTable(1); PdfPCell cell1 = new PdfPCell(cumulative); cell1.setPaddingBottom(3f); cell1.setBorder(Rectangle.NO_BORDER); PdfPCell cell2 = new PdfPCell(creditGpaGrade); cell2.setBorder(Rectangle.NO_BORDER); p.addCell(cell1); p.addCell(cell2); table.addCell(p); } else { table.addCell(getCellForString((String) list.get(i), 0, true, Element.ALIGN_MIDDLE, Element.ALIGN_CENTER, font9, true)); } if (colCount == 12) { break; } colCount++; } return table; }
From source file:generators.InvoiceEventListener.java
@Override public void onEndPage(PdfWriter writer, Document document) { Font defaultFont = new Font(Font.FontFamily.TIMES_ROMAN, 12); try {//from w w w .j av a2 s .com PdfPTable footerTable = new PdfPTable(3); footerTable.setTotalWidth(document.right(document.leftMargin())); footerTable.getDefaultCell().setBorder(Rectangle.TOP); footerTable.addCell(new Paragraph("Lionsclub Oegstgeest/Warmond", defaultFont)); footerTable.completeRow(); footerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); footerTable.addCell(new Paragraph("Betaalrekening", defaultFont)); footerTable.addCell(new Paragraph(": ************", defaultFont)); footerTable.completeRow(); footerTable.addCell(new Paragraph("Inschrijvnummer KvK Rijnland", defaultFont)); footerTable.addCell(new Paragraph(": ************ ", defaultFont)); footerTable.completeRow(); footerTable.writeSelectedRows(0, -1, document.leftMargin(), document.bottom(footerTable.getTotalHeight()) - document.bottomMargin() + 15, writer.getDirectContent()); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_RIGHT, new Phrase(String.format("%d", writer.getPageNumber()), defaultFont), document.right(), document.bottom() - document.bottomMargin() + 18, 0); } catch (Exception e) { e.printStackTrace(); } }
From source file:generators.InvoiceGenerator.java
/** * Generate Invoice pdf file/*from w ww. j a v a 2 s . c om*/ * * @param order the order * @throws DocumentException the document exception * @throws IOException the io exception */ public void generate(Order order) throws DocumentException, IOException { Date invoiceDate = order.getDate(); SimpleDateFormat sdf = new SimpleDateFormat("dd MMMM YYYY"); // User guest = order.getGuest(); User guest = new UserDAO().get(order.getUserId()); guest.setOrder(order); System.out.println("invoice generator orderID: " + order.getId()); Document document = new Document(); Font defaultFont = new Font(Font.FontFamily.TIMES_ROMAN, 12); System.out.println(System.getProperty("user.dir")); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(System.getProperty("user.dir") + "/src/main/java/nl/ipsen3/invoice/" + new SimpleDateFormat("dd-MM-yyyy").format(invoiceDate) + " - " + order.getId() + ".pdf")); document.setMargins(30, 30, 30, 65); writer.setPageEvent(new InvoiceEventListener()); document.open(); Paragraph header = new Paragraph("Lionsclub Oegstgeest/Warmond", new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD)); header.setAlignment(Element.ALIGN_CENTER); document.add(header); AddressDAO addressDAO = new AddressDAO(); Address userAddress = addressDAO.get(guest.getAddressId()); Paragraph address = new Paragraph(guest.getFirstName() + " " + guest.getPrefixLastName() + " " + guest.getLastName() + "\n" + userAddress.getStreet() + " " + userAddress.getHouseNumber() + "\n" + userAddress.getZipCode() + " " + userAddress.getCity(), defaultFont); address.setSpacingBefore(35); address.setSpacingAfter(25); address.setLeading(15); document.add(address); Paragraph invoiceDetails = new Paragraph("Factuurdatum: " + sdf.format(invoiceDate) + "\n" + "FactuurNummer: " + order.getId() + " \n" + "Debiteurennummer: " + guest.getId(), defaultFont); invoiceDetails.setSpacingAfter(15); invoiceDetails.setLeading(15); document.add(invoiceDetails); Paragraph subject = new Paragraph("Betreft: Onderwerp factuur", defaultFont); subject.setSpacingAfter(30); document.add(subject); PdfPTable orderTable = new PdfPTable(10); PdfPCell wineCell = new PdfPCell(new Paragraph("Wijn", defaultFont)); wineCell.setColspan(5); wineCell.setBorder(Rectangle.BOTTOM); orderTable.getDefaultCell().setPaddingBottom(10); orderTable.getDefaultCell().setBorder(Rectangle.BOTTOM); ; orderTable.addCell(new Paragraph("Code", defaultFont)); orderTable.addCell(new Paragraph("Aantal", defaultFont)); orderTable.addCell(wineCell); orderTable.addCell(new Paragraph("Jaar", defaultFont)); orderTable.addCell(new Paragraph("Per Fles", defaultFont)); orderTable.addCell(new Paragraph("Bedrag", defaultFont)); orderTable.getDefaultCell().setPaddingBottom(0); orderTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); wineCell.setBorder(Rectangle.NO_BORDER); NumberFormat numberFormat = NumberFormat.getCurrencyInstance(Locale.GERMANY); for (WineOrder wineOrder : order.getWineOrders()) { orderTable.addCell(new Paragraph("" + wineOrder.getWine().getId(), defaultFont)); orderTable.addCell(new Paragraph("" + wineOrder.getAmount(), defaultFont)); wineCell.setPhrase(new Phrase(wineOrder.getWine().getName(), defaultFont)); orderTable.addCell(wineCell); orderTable.addCell(new Paragraph("" + wineOrder.getWine().getYear(), defaultFont)); orderTable.addCell(new Paragraph( " " + numberFormat.format(wineOrder.getWine().getPrice()).replace(" ", ""), defaultFont)); orderTable.addCell(new Paragraph(" " + numberFormat .format(wineOrder.getAmount() * wineOrder.getWine().getPrice()).replace(" ", ""), defaultFont)); orderTable.completeRow(); } orderTable.addCell(" "); orderTable.completeRow(); Font totalFont = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); PdfPCell totalAmount = new PdfPCell( new Paragraph(" " + numberFormat.format(order.getTotalAmount()).replace(" ", ""), totalFont)); totalAmount.setBorder(Rectangle.TOP); totalAmount.setPaddingTop(10); PdfPCell totalCell = new PdfPCell(new Paragraph("Totaal", totalFont)); totalCell.setPaddingTop(10); totalCell.setBorder(Rectangle.NO_BORDER); orderTable.addCell(totalCell); PdfPCell fillerCell = new PdfPCell(new Paragraph("")); fillerCell.setColspan(8); fillerCell.setBorder(Rectangle.NO_BORDER); orderTable.addCell(fillerCell); orderTable.addCell(totalAmount); orderTable.setSpacingBefore(15); orderTable.setSpacingAfter(30); orderTable.setWidthPercentage(95); orderTable.setHorizontalAlignment(Element.ALIGN_CENTER); document.add(orderTable); Paragraph retrievalDetails = new Paragraph( "Wij verzoeken u vriendelijk het totaalbedrag binnen 7 dagen na factuurdatum over te maken op bankrekening <bankAccountNr> t.n.v <bankAccountName> onder vermelding van het factuurnummer", defaultFont); retrievalDetails.setLeading(15); retrievalDetails.setSpacingAfter(20); document.add(retrievalDetails); // document.add(new Paragraph("U kunt uw wijnen ophalen op " + sdf.format(invoiceDate) , defaultFont)); // document.add(new Paragraph("Adres:", defaultFont)); // // PdfPTable addressTable = new PdfPTable(1); // addressTable.setSpacingBefore(5); // addressTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); // addressTable.getDefaultCell().setPaddingLeft(35); // MerchantService merchantService = new MerchantService(); // Merchant merchant = merchantService.find(merchantService.all().get(0).getId()); // addressTable.addCell(new Paragraph(merchant.getName(), defaultFont)); // addressTable.addCell(new Paragraph(merchant.getAddress().getStreet() // + " " + merchant.getAddress().getHouseNumber(), defaultFont)); // addressTable.addCell(new Paragraph(merchant.getAddress().getZipCode() + " " + // merchant.getAddress().getCity(), defaultFont)); // addressTable.setHorizontalAlignment(Element.ALIGN_LEFT); // document.add(addressTable); document.close(); System.out.println( "Succesfully generated IPSEN2.invoice: " + order.getId() + " on Date: " + sdf.format(invoiceDate)); }
From source file:GUI.PHIEUDHGUI.java
private void InPhieuEvent(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InPhieuEvent // TODO add your handling code here: if (jTable5.getRowCount() > 0) { String path = ""; JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new File(System.getProperty("user.home"))); int result = fileChooser.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooser.getSelectedFile(); path = selectedFile.getAbsolutePath().isEmpty() ? "phieudathang.pdf" : selectedFile.getAbsolutePath() + ".pdf"; try { // BaseFont courier = BaseFont.createFont(BaseFont.COURIER, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); // Font font = new Font(courier, 12, Font.NORMAL); BaseFont baseFont = BaseFont.createFont("C://Windows//Fonts//vuTimes.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font = new Font(baseFont, 8); // FontFactory.registerDirectories(); // Font font = FontFactory.getFont("Times New Roman"); Chunk chunk = new Chunk("", font); Document doc = new Document(); PdfWriter.getInstance(doc, new FileOutputStream(path)); doc.open();/*from w w w. ja v a 2 s . c om*/ doc.add(chunk); PdfPTable pdfTable = new PdfPTable(jTable5.getColumnCount()); //adding table headers for (int i = 0; i < jTable5.getColumnCount(); i++) { pdfTable.addCell(new Phrase(jTable5.getColumnName(i), font)); } //extracting data from the JTable and inserting it to PdfPTable for (int rows = 0; rows < jTable5.getRowCount() - 1; rows++) { for (int cols = 0; cols < jTable5.getColumnCount(); cols++) { pdfTable.addCell( new Phrase(jTable5.getModel().getValueAt(rows, cols).toString(), font)); } } doc.add(pdfTable); doc.close(); System.out.println("done"); } catch (FileNotFoundException ex) { Logger.getLogger(THONGKECHIGUI.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException ex) { Logger.getLogger(THONGKECHIGUI.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(THONGKECHIGUI.class.getName()).log(Level.SEVERE, null, ex); } } } else JOptionPane.showMessageDialog(this, "Ch?n phiu cn in"); }
From source file:GUI.THONGKECHIGUI.java
private void inThongKeChiEvent(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inThongKeChiEvent if (jTable2.getRowCount() > 0) { String path = ""; JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new File(System.getProperty("user.home"))); int result = fileChooser.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { File selectedFile = fileChooser.getSelectedFile(); path = selectedFile.getAbsolutePath().isEmpty() ? "thongke.pdf" : selectedFile.getAbsolutePath() + ".pdf"; try { // BaseFont courier = BaseFont.createFont(BaseFont.COURIER, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); // Font font = new Font(courier, 12, Font.NORMAL); BaseFont baseFont = BaseFont.createFont("C://Windows//Fonts//vuTimes.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font = new Font(baseFont, 8); // FontFactory.registerDirectories(); // Font font = FontFactory.getFont("Times New Roman"); Chunk chunk = new Chunk("", font); Document doc = new Document(); PdfWriter.getInstance(doc, new FileOutputStream(path)); doc.open();//ww w .j ava 2 s . c o m doc.add(chunk); PdfPTable pdfTable = new PdfPTable(jTable2.getColumnCount()); //adding table headers for (int i = 0; i < jTable2.getColumnCount(); i++) { pdfTable.addCell(new Phrase(jTable2.getColumnName(i), font)); } //extracting data from the JTable and inserting it to PdfPTable for (int rows = 0; rows < jTable2.getRowCount() - 1; rows++) { for (int cols = 0; cols < jTable2.getColumnCount(); cols++) { pdfTable.addCell( new Phrase(jTable2.getModel().getValueAt(rows, cols).toString(), font)); } } doc.add(pdfTable); doc.close(); System.out.println("done"); } catch (FileNotFoundException ex) { Logger.getLogger(THONGKECHIGUI.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException ex) { Logger.getLogger(THONGKECHIGUI.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(THONGKECHIGUI.class.getName()).log(Level.SEVERE, null, ex); } } } }
From source file:hr.ws4is.tn3812.drivers.listeners.PdfListener.java
License:Open Source License
@Override public void onStart(final IControls controls) { this.controls = controls; Rectangle ps = null;//from w w w . j a va2 s . com if (controls.getPageOrientation() == SCSPageOrientation.LANDSCAPE) { ps = PageSize.A4.rotate(); } else { ps = PageSize.A4; } document = new Document(ps, 15, 0, 0, 0); font = new Font(courier, controls.getFontSize()); fontBold = new Font(courier, controls.getFontSize()); fontBold.setStyle(Font.BOLD); current = font; file = prepareFile(); fos = open(file); try { printWriter = PdfWriter.getInstance(document, fos); printWriter.setViewerPreferences(PdfWriter.PrintScalingNone); } catch (DocumentException exception) { LOGGER.error(exception.getMessage(), exception); } document.open(); }
From source file:htmlparser.pdf.PDFFile.java
public void createScoreTable(Color oddrow_color, Color title_bg_color, Color title_font_color, int highlight) { if (this.opened) { int columnNumber = 0; for (String s : this.parser.getTeams().get(0).getData()) { columnNumber++;//from www . jav a 2 s . com } PdfPTable table = new PdfPTable(columnNumber + 1); Font f = new Font(this.fonttype, 13); int row = 1; Font headline = new Font(f); headline.setStyle("bold"); headline.setSize(16); headline.setColor(new BaseColor(title_bg_color.getRGB())); PdfPCell headcell = new PdfPCell(new Paragraph(this.parser.getCompetitionName(), headline)); headcell.setColspan(columnNumber + 1); headcell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(headcell); Font title = new Font(f); title.setStyle("bold"); title.setColor(new BaseColor(title_font_color.getRGB())); for (String s : this.shColNms) { PdfPCell cell = new PdfPCell(new Paragraph(s, title)); cell.setBackgroundColor(new BaseColor(title_bg_color.getRGB())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); } row++; int order = 1; Font tfont = f; Font bold = new Font(f); bold.setStyle("bold"); for (Team t : this.parser.getTeams()) { if (highlight >= 0) { if (order == highlight + 1) { tfont = bold; } else { tfont = f; } } PdfPCell ordercell = new PdfPCell(new Paragraph(Integer.toString(order), tfont)); ordercell.setHorizontalAlignment(Element.ALIGN_CENTER); if (row % 2 == 0) { ordercell.setBackgroundColor(new BaseColor(oddrow_color.getRGB())); } table.addCell(ordercell); for (String s : t.getData()) { PdfPCell cell = new PdfPCell(new Paragraph(s, tfont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); if (row % 2 == 0) { cell.setBackgroundColor(new BaseColor(oddrow_color.getRGB())); } table.addCell(cell); } order++; row++; } try { float[] widths = { 12f, 40f, 13f, 5f, 5f, 5f, 10f, 10f }; table.setWidths(widths); this.document.add(table); } catch (DocumentException ex) { System.out.println("Content exception"); } } }
From source file:htmlparser.pdf.PDFFile.java
public void createMatchTable(Color oddrow_color, Color title_bg_color, Color title_font_color) { if (this.opened) { this.document.newPage(); int columnNumber = 0; for (String s : this.parser.getMatches().get(0).getData()) { columnNumber++;/*from w ww . j av a 2s .co m*/ } PdfPTable table = new PdfPTable(columnNumber); Font f = new Font(this.fonttype, 13); int row = 1; Font headline = new Font(f); headline.setStyle("bold"); headline.setSize(16); headline.setColor(new BaseColor(title_bg_color.getRGB())); PdfPCell headcell = new PdfPCell(new Paragraph(this.parser.getTeamName(), headline)); headcell.setColspan(columnNumber); headcell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(headcell); Font title = new Font(f); title.setStyle("bold"); title.setColor(new BaseColor(title_font_color.getRGB())); for (String s : this.mhColNms) { PdfPCell cell = new PdfPCell(new Paragraph(s, title)); cell.setBackgroundColor(new BaseColor(title_bg_color.getRGB())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); } row++; for (Match t : this.parser.getMatches()) { for (String s : t.getData()) { PdfPCell cell = new PdfPCell(new Paragraph(s, f)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); if (row % 2 == 0) { cell.setBackgroundColor(new BaseColor(oddrow_color.getRGB())); } table.addCell(cell); } row++; } try { float[] widths = { 26f, 26f, 20f, 8f, 20f }; table.setWidths(widths); this.document.add(table); } catch (DocumentException ex) { } } }
From source file:main.ItextPDF.java
public void createPdf(String filename, Person person) { // step 1/*from w ww. ja v a 2 s .co m*/ Document document = new Document(); // step 2 try { PdfWriter.getInstance(document, new FileOutputStream(filename)); // step 3 document.open(); BaseFont bf_ru = BaseFont.createFont(FONT_RU, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font_ru = new Font(bf_ru, 10); BaseFont bf_ch = BaseFont.createFont(FONT_CH, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); Font font_ch = new Font(bf_ch, 10); ResourceBundle rb_ch = ResourceBundle.getBundle("bundles/lang", Locale.CHINA); ResourceBundle rb_ru = ResourceBundle.getBundle("bundles/lang", Locale.GERMANY); // Paragraph preface = new Paragraph(rb_ch.getString("pdfFileheder1"), font_ch); preface.setAlignment(Element.ALIGN_CENTER); document.add(preface); preface = new Paragraph(rb_ru.getString("pdfFileheder1"), font_ru); preface.setAlignment(Element.ALIGN_CENTER); document.add(preface); document.add(new Phrase(rb_ch.getString("pdfFileheder2"), font_ch)); document.add(new Phrase(rb_ru.getString("pdfFileheder2"), font_ru)); Phrase pr = new Phrase("\n "); pr.add(new Phrase(rb_ch.getString("part1"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("part1"), font_ru)); document.add(pr); PdfPTable basetable = new PdfPTable(2); basetable.setWidthPercentage(100); PdfPTable table1 = new PdfPTable(4); pr = new Phrase(rb_ch.getString("nameDesc"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("nameDesc"), font_ru)); PdfPCell cell = new PdfPCell(pr); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.setRowspan(3); table1.addCell(cell); //line 1 //PdfPTable table2 = new PdfPTable(2); pr = new Phrase(rb_ch.getString("lastname"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("lastname"), font_ru)); PdfPCell cell1 = new PdfPCell(pr); PdfPCell cell2 = new PdfPCell(new Paragraph(person.getField1())); cell2.setColspan(2); table1.addCell(cell1); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("fathername"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("fathername"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph(person.getField2())); table1.addCell(cell1); cell2.setColspan(2); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("firstname"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("firstname"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph(person.getField3())); table1.addCell(cell1); cell2.setColspan(2); table1.addCell(cell2); //basetable.addCell(table1); //basetable.addCell(table2); ///line 2 1.2 1.3 //table1 = new PdfPTable(4); pr = new Phrase(rb_ch.getString("chinaseName"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("chinaseName"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph(person.getField4())); table1.addCell(cell1); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("othername"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("othername"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph(person.getField5())); table1.addCell(cell1); table1.addCell(cell2); //1.4 1.5 pr = new Phrase(rb_ch.getString("sex"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("sex"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph(person.getField6() + " " + person.getField7())); table1.addCell(cell1); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("databirth"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("databirth"), font_ru)); cell1 = new PdfPCell(pr); pr = new Phrase(); pr.add(new Phrase(person.getField8())); pr.add(new Phrase("/")); pr.add(new Phrase(person.getField9())); pr.add(new Phrase("/")); pr.add(new Phrase(person.getField10())); cell2 = new PdfPCell(pr); table1.addCell(cell1); table1.addCell(cell2); //1.6 1.7 pr = new Phrase(rb_ch.getString("citizen"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("citizen"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph(person.getField11())); table1.addCell(cell1); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("old_citizen_of"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("old_citizen_of"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph(person.getField12())); table1.addCell(cell1); table1.addCell(cell2); //1.8 pr = new Phrase(rb_ch.getString("birthplace"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("birthplace"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph(person.getField13())); cell1.setColspan(2); table1.addCell(cell1); cell2.setColspan(2); table1.addCell(cell2); //1.9 pr = new Phrase(rb_ch.getString("passportData"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("passportData"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph(person.getField14())); cell1.setColspan(2); table1.addCell(cell1); cell2.setColspan(2); table1.addCell(cell2); //1.10 pr = new Phrase(rb_ch.getString("passportType"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("passportType"), font_ru)); cell1 = new PdfPCell(pr); pr = new Phrase(person.getField15() + " " + person.getField16() + " " + person.getField17() + " " + person.getField18() + " " + person.getField19(), font_ru); cell2 = new PdfPCell(pr); cell1.setColspan(2); table1.addCell(cell1); cell2.setColspan(2); table1.addCell(cell2); //1.11 1.12 pr = new Phrase(rb_ch.getString("passportNumber"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("passportNumber"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph(person.getField20())); table1.addCell(cell1); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("passportGivenDate"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("passportGivenDate"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell( new Paragraph(person.getField21() + "/" + person.getField22() + "/" + person.getField23())); table1.addCell(cell1); table1.addCell(cell2); //1.13 1.14 pr = new Phrase(rb_ch.getString("passportGivenPlace"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("passportGivenPlace"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph(person.getField24())); table1.addCell(cell1); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("passportValidDate"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("passportValidDate"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell( new Paragraph(person.getField25() + "/" + person.getField26() + "/" + person.getField27())); table1.addCell(cell1); table1.addCell(cell2); //1.15 pr = new Phrase(rb_ch.getString("passportProfession"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("passportProfession"), font_ru)); cell1 = new PdfPCell(pr); /*cell2 = new PdfPCell(new Paragraph( person.getField28() + " " + person.getField29() + " " + person.getField30() ));*/ table1.addCell(cell1); //table1.addCell(cell2); //cell2 = new PdfPCell(new Paragraph(rs.getString("FIELD" + 16))); PdfPTable innertable = new PdfPTable(2); innertable.setWidthPercentage(100); pr = new Phrase(rb_ch.getString("profession1"), font_ch); if (!person.getField28().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession1"), font_ru)); PdfPCell innercell = new PdfPCell(pr); //innercell.setBorder(Rectangle.BOTTOM); innertable.addCell(innercell); pr = new Phrase(rb_ch.getString("profession10"), font_ch); if (!person.getField37().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField38(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession10"), font_ru)); innercell = new PdfPCell(pr); //innercell.setBorder(Rectangle.LEFT); innertable.addCell(innercell); pr = new Phrase(rb_ch.getString("profession2"), font_ch); if (!person.getField29().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession2"), font_ru)); innercell = new PdfPCell(pr); //innercell.setBorder(Rectangle.BOTTOM); innertable.addCell(innercell); pr = new Phrase(rb_ch.getString("profession11"), font_ch); if (!person.getField39().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField40(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession11"), font_ru)); innercell = new PdfPCell(pr); //innercell.setBorder(Rectangle.LEFT); innertable.addCell(innercell); pr = new Phrase(rb_ch.getString("profession3"), font_ch); if (!person.getField30().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession3"), font_ru)); innercell = new PdfPCell(pr); //innercell.setBorder(Rectangle.RIGHT); innertable.addCell(innercell); pr = new Phrase(rb_ch.getString("profession12"), font_ch); if (!person.getField41().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField42(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession12"), font_ru)); innercell = new PdfPCell(pr); //innercell.setBorder(Rectangle.NO_BORDER); innertable.addCell(innercell); pr = new Phrase(rb_ch.getString("profession4"), font_ch); if (!person.getField31().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession4"), font_ru)); innercell = new PdfPCell(pr); //innercell.setBorder(Rectangle.RIGHT); innertable.addCell(innercell); pr = new Phrase(rb_ch.getString("profession13"), font_ch); if (!person.getField43().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession13"), font_ru)); innercell = new PdfPCell(pr); //innercell.setBorder(Rectangle.NO_BORDER); innertable.addCell(innercell); pr = new Phrase(rb_ch.getString("profession5"), font_ch); if (!person.getField32().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession5"), font_ru)); innercell = new PdfPCell(pr); //innercell.setBorder(Rectangle.RIGHT); innertable.addCell(innercell); pr = new Phrase(rb_ch.getString("profession14"), font_ch); if (!person.getField44().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession14"), font_ru)); innercell = new PdfPCell(pr); //innercell.setBorder(Rectangle.NO_BORDER); innertable.addCell(innercell); pr = new Phrase(rb_ch.getString("profession6"), font_ch); if (!person.getField33().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession6"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("profession15"), font_ch); if (!person.getField45().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession15"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("profession7"), font_ch); if (!person.getField34().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession7"), font_ru)); innertable.addCell(pr); pr = new Phrase(""); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("profession8"), font_ch); if (!person.getField35().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession8"), font_ru)); innertable.addCell(pr); pr = new Phrase(""); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("profession9"), font_ch); if (!person.getField36().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession9"), font_ru)); innertable.addCell(pr); pr = new Phrase(""); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("profession16"), font_ch); if (!person.getField173().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(person.getField174(), font_ru)); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("profession16"), font_ru)); innertable.addCell(pr); pr = new Phrase(""); innertable.addCell(pr); cell2.setColspan(3); cell2.addElement(innertable); table1.addCell(cell2); //1.16 pr = new Phrase(rb_ch.getString("education"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("education"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph("")); cell1.setColspan(1); table1.addCell(cell1); innertable = new PdfPTable(2); innertable.setWidthPercentage(100); pr = new Phrase(rb_ch.getString("education1"), font_ch); if (!person.getField46().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("education1"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("education2"), font_ch); if (!person.getField47().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("education2"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("education3"), font_ch); if (!person.getField48().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField49(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("education3"), font_ru)); innertable.addCell(pr); innertable.addCell(new Phrase()); cell2.setColspan(3); cell2.addElement(innertable); table1.addCell(cell2); //1.17 pr = new Phrase(rb_ch.getString("workPlace"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("workPlace"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph("")); cell1.setColspan(1); table1.addCell(cell1); innertable = new PdfPTable(2); innertable.setWidthPercentage(100); pr = new Phrase(rb_ch.getString("workPlace1"), font_ch); if (!person.getField50().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField50(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("workPlace1"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("workPlace2"), font_ch); if (!person.getField51().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField51(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("workPlace2"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("workPlace3"), font_ch); if (!person.getField52().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField52(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("workPlace3"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("workPlace4"), font_ch); if (!person.getField53().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField53(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("workPlace4"), font_ru)); innertable.addCell(pr); cell2.setColspan(3); cell2.addElement(innertable); table1.addCell(cell2); // PdfPCell tcell = new PdfPCell(table1); tcell.setColspan(2); basetable.addCell(tcell); // document.add(basetable); //////////////////////////////////////////////////////////page2 basetable = new PdfPTable(2); basetable.setWidthPercentage(100); table1 = new PdfPTable(4); //1.18 1.19 pr = new Phrase(rb_ch.getString("homeAddr"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("homeAddr"), font_ru)); cell1 = new PdfPCell(pr); pr = new Paragraph(""); if (!person.getField54().equals("")) { pr.add(new Phrase(person.getField54(), font_ru)); } cell2 = new PdfPCell(pr); table1.addCell(cell1); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("zipCode"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("zipCode"), font_ru)); cell1 = new PdfPCell(pr); pr = new Paragraph(""); if (!person.getField55().equals("")) { pr.add(new Phrase(person.getField55(), font_ru)); } cell2 = new PdfPCell(pr); table1.addCell(cell1); table1.addCell(cell2); //1.20 1.21 pr = new Phrase(rb_ch.getString("phoneNum"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("phoneNum"), font_ru)); cell1 = new PdfPCell(pr); pr = new Paragraph(""); if (!person.getField56().equals("")) { pr.add(new Phrase(person.getField56(), font_ru)); } cell2 = new PdfPCell(pr); table1.addCell(cell1); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("email"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("email"), font_ru)); cell1 = new PdfPCell(pr); pr = new Paragraph(""); if (!person.getField57().equals("")) { pr.add(new Phrase(person.getField57(), font_ru)); } cell2 = new PdfPCell(pr); table1.addCell(cell1); table1.addCell(cell2); //1.22 pr = new Phrase(rb_ch.getString("familyStatus"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("familyStatus"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(" "); if (!person.getField66().equals("")) { pr.add(new Phrase(rb_ru.getString("familyStatus1"), font_ru)); pr.add(new Phrase(" ")); } if (!person.getField67().equals("")) { pr.add(new Phrase(rb_ru.getString("familyStatus2"), font_ru)); pr.add(new Phrase(" ")); } if (!person.getField68().equals("")) { pr.add(new Phrase(rb_ru.getString("familyStatus3"), font_ru)); pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField69(), font_ru)); } cell2 = new PdfPCell(pr); cell2.setColspan(3); table1.addCell(cell2); /*tcell = new PdfPCell(table1); tcell.setColspan(2); basetable.addCell(tcell);*/ //1.23 pr = new Phrase(rb_ch.getString("familyStaff"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("familyStaff"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); innertable = new PdfPTable(4); innertable.setWidthPercentage(100); pr = new Phrase(rb_ch.getString("familyStaff1"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("familyStaff1"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("familyStaff2"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("familyStaff2"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("familyStaff3"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("familyStaff3"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("familyStaff4"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("familyStaff4"), font_ru)); innertable.addCell(pr); //add 4 empty row //for(int l =0 ; l < 16; l++){ innertable.addCell(new Phrase(person.getField58(), font_ru)); innertable.addCell(new Phrase(person.getField59(), font_ru)); innertable.addCell(new Phrase(person.getField60(), font_ru)); innertable.addCell(new Phrase(person.getField61(), font_ru)); innertable.addCell(new Phrase(person.getField62(), font_ru)); innertable.addCell(new Phrase(person.getField63(), font_ru)); innertable.addCell(new Phrase(person.getField64(), font_ru)); innertable.addCell(new Phrase(person.getField65(), font_ru)); innertable.addCell(new Phrase(person.getField66(), font_ru)); innertable.addCell(new Phrase(person.getField67(), font_ru)); innertable.addCell(new Phrase(person.getField68(), font_ru)); innertable.addCell(new Phrase(person.getField69(), font_ru)); innertable.addCell(new Phrase(person.getField70(), font_ru)); innertable.addCell(new Phrase(person.getField71(), font_ru)); innertable.addCell(new Phrase(person.getField72(), font_ru)); innertable.addCell(new Phrase(person.getField73(), font_ru)); //} tcell = new PdfPCell(innertable); tcell.setColspan(3); table1.addCell(tcell); //1.24 pr = new Phrase(rb_ch.getString("contactPerson"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("contactPerson"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); innertable = new PdfPTable(2); innertable.setWidthPercentage(100); pr = new Phrase(rb_ch.getString("contactPerson1"), font_ch); if (!person.getField74().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField74(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("contactPerson1"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("contactPerson2"), font_ch); if (!person.getField75().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField75(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("contactPerson2"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("contactPerson3"), font_ch); if (!person.getField76().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField76(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("contactPerson3"), font_ru)); innertable.addCell(pr); pr = new Phrase(" "); innertable.addCell(pr); tcell = new PdfPCell(innertable); tcell.setColspan(3); table1.addCell(tcell); //1.25 pr = new Phrase(rb_ch.getString("visitedPlace"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("visitedPlace"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(2); table1.addCell(cell1); pr = new Phrase(""); if (!person.getField77().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField77(), font_ru)); } cell2 = new PdfPCell(pr); cell2.setColspan(2); table1.addCell(cell2); // tcell = new PdfPCell(table1); tcell.setColspan(2); basetable.addCell(tcell); ////////////////////////////////////////////// document.add(basetable); ///////////////////////////////////////part2 pr = new Phrase("\n"); pr.add(new Phrase(rb_ch.getString("part2Title"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("part2Title"), font_ru)); pr.add(new Phrase("\n")); document.add(pr); //2.1 basetable = new PdfPTable(2); basetable.setWidthPercentage(100); table1 = new PdfPTable(2); table1.setWidths(new int[] { 1, 5 }); pr = new Phrase(rb_ch.getString("travelPurpose"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose"), font_ru)); cell1 = new PdfPCell(pr); cell1.setRowspan(6); table1.addCell(cell1); innertable = new PdfPTable(2); innertable.setWidthPercentage(100); pr = new Phrase(rb_ch.getString("travelPurpose1"), font_ch); if (!person.getField78().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose1"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose8"), font_ch); if (!person.getField79().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose8"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose2"), font_ch); if (!person.getField80().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose2"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose9"), font_ch); if (!person.getField82().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose9"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose3"), font_ch); if (!person.getField81().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose3"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose10"), font_ch); if (!person.getField84().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose10"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose4"), font_ch); if (!person.getField83().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose4"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose11"), font_ch); if (!person.getField86().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose11"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose5"), font_ch); if (!person.getField85().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose5"), font_ru)); innertable.addCell(pr); innertable.addCell(new Phrase(" ")); pr = new Phrase(rb_ch.getString("travelPurpose6"), font_ch); if (!person.getField87().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose6"), font_ru)); innertable.addCell(pr); innertable.addCell(new Phrase(" ")); pr = new Phrase(rb_ch.getString("travelPurpose7"), font_ch); if (!person.getField88().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose7"), font_ru)); innertable.addCell(pr); innertable.addCell(new Phrase(" ")); innertable.addCell(new Phrase()); cell2.addElement(innertable); table1.addCell(cell2); // innertable = new PdfPTable(2); innertable.setWidthPercentage(100); pr = new Phrase(rb_ch.getString("travelPurpose12"), font_ch); if (!person.getField89().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose12"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose13"), font_ch); if (!person.getField90().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose13"), font_ru)); innertable.addCell(pr); /*for(int j=12; j < 14; j++){ pr = new Phrase(rb_ch.getString("travelPurpose"+j), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("travelPurpose"+j), font_ru)); innertable.addCell(pr); }*/ cell2 = new PdfPCell(new Phrase("")); cell2.addElement(innertable); table1.addCell(cell2); // innertable = new PdfPTable(2); innertable.setWidthPercentage(100); /*for(int j=14; j < 16; j++){ pr = new Phrase(rb_ch.getString("travelPurpose"+j), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("travelPurpose"+j), font_ru)); innertable.addCell(pr); }*/ pr = new Phrase(rb_ch.getString("travelPurpose14"), font_ch); if (!person.getField91().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose14"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose15"), font_ch); if (!person.getField92().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose15"), font_ru)); innertable.addCell(pr); cell2 = new PdfPCell(new Phrase("")); cell2.addElement(innertable); table1.addCell(cell2); // innertable = new PdfPTable(2); innertable.setWidthPercentage(100); pr = new Phrase(rb_ch.getString("travelPurpose16"), font_ch); if (!person.getField93().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose16"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose17"), font_ch); if (!person.getField94().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose17"), font_ru)); innertable.addCell(pr); /*for(int j=16; j < 18; j++){ pr = new Phrase(rb_ch.getString("travelPurpose"+j), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("travelPurpose"+j), font_ru)); innertable.addCell(pr); }*/ cell2 = new PdfPCell(new Phrase("")); cell2.addElement(innertable); table1.addCell(cell2); // innertable = new PdfPTable(2); innertable.setWidthPercentage(100); /*for(int j=18; j < 20; j++){ pr = new Phrase(rb_ch.getString("travelPurpose"+j), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("travelPurpose"+j), font_ru)); innertable.addCell(pr); }*/ pr = new Phrase(rb_ch.getString("travelPurpose18"), font_ch); if (!person.getField95().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose18"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("travelPurpose19"), font_ch); if (!person.getField96().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose19"), font_ru)); innertable.addCell(pr); cell2 = new PdfPCell(new Phrase("")); cell2.addElement(innertable); table1.addCell(cell2); // innertable = new PdfPTable(2); innertable.setWidthPercentage(100); pr = new Phrase(rb_ch.getString("travelPurpose20"), font_ch); if (!person.getField97().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField98(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("travelPurpose20"), font_ru)); PdfPCell innerCell2 = new PdfPCell(pr); innerCell2.setColspan(2); innertable.addCell(innerCell2); cell2 = new PdfPCell(new Phrase("")); cell2.addElement(innertable); table1.addCell(cell2); ///2.2 pr = new Phrase(rb_ch.getString("planingTravel"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("planingTravel"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(rb_ch.getString("planingTravel1"), font_ch); if (!person.getField99().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("planingTravel1"), font_ru)); pr.add(new Phrase("\n \n")); pr.add(new Phrase(rb_ch.getString("planingTravel2"), font_ch)); if (!person.getField100().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("planingTravel2"), font_ru)); pr.add(new Phrase("\n \n")); pr.add(new Phrase(rb_ch.getString("planingTravel3"), font_ch)); if (!person.getField101().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("planingTravel3"), font_ru)); pr.add(new Phrase("\n \n")); pr.add(new Phrase(rb_ch.getString("planingTravel4"), font_ch)); if (!person.getField102().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("planingTravel4"), font_ru)); pr.add(new Phrase("\n \n")); pr.add(new Phrase(rb_ch.getString("planingTravel5"), font_ch)); if (!person.getField103().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField104(), font_ch)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("planingTravel5"), font_ru)); pr.add(new Phrase("\n \n")); cell2 = new PdfPCell(pr); table1.addCell(cell2); tcell = new PdfPCell(table1); tcell.setColspan(2); basetable.addCell(tcell); ///////////////////////////////////// table1 = new PdfPTable(2); table1.setWidths(new int[] { 4, 1 }); pr = new Phrase(rb_ch.getString("fastService"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("fastService"), font_ru)); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ch.getString("fastService2"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("fastService2"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(""); if (!person.getField144().equals("")) { pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } if (!person.getField105().equals("")) { pr.add(new Phrase(rb_ch.getString("no"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("no"), font_ru)); } cell2 = new PdfPCell(pr); table1.addCell(cell2); tcell = new PdfPCell(table1); tcell.setColspan(2); basetable.addCell(tcell); document.add(basetable); //////////////////////////////////////////////////////////page3 basetable = new PdfPTable(2); basetable.setWidthPercentage(100); table1 = new PdfPTable(3); table1.setWidths(new int[] { 1, 1, 1 }); //2.4 2.5 pr = new Phrase(rb_ch.getString("dataSuggestion"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("dataSuggestion"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph("")); cell1.setColspan(2); table1.addCell(cell1); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("dataViseted"), font_ch); if (!person.getField106().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField106(), font_ch)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("dataViseted"), font_ru)); cell1 = new PdfPCell(pr); cell2 = new PdfPCell(new Paragraph("")); cell1.setColspan(2); table1.addCell(cell1); table1.addCell(cell2); //2.6 pr = new Phrase(rb_ch.getString("marshrut"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("marshrut"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); innertable = new PdfPTable(2); innertable.setWidthPercentage(100); pr = new Phrase(rb_ch.getString("date"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("date"), font_ru)); innertable.addCell(pr); pr = new Phrase(rb_ch.getString("addressMore"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("addressMore"), font_ru)); innertable.addCell(pr); //add 4 empty row /*for(int l =0 ; l < 10; l++){ innertable.addCell(new Phrase(" ")); }*/ pr = new Phrase(""); if (!person.getField107().equals("")) { pr.add(new Phrase(person.getField107(), font_ru)); } if (!person.getField108().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField108(), font_ru)); } if (!person.getField109().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField109(), font_ru)); } innertable.addCell(pr); pr = new Phrase(""); if (!person.getField110().equals("")) { pr.add(new Phrase(person.getField110(), font_ru)); } innertable.addCell(pr); pr = new Phrase(""); if (!person.getField111().equals("")) { pr.add(new Phrase(person.getField111(), font_ru)); } if (!person.getField112().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField112(), font_ru)); } if (!person.getField113().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField113(), font_ru)); } innertable.addCell(pr); pr = new Phrase(""); if (!person.getField114().equals("")) { pr.add(new Phrase(person.getField114(), font_ru)); } innertable.addCell(pr); pr = new Phrase(""); if (!person.getField115().equals("")) { pr.add(new Phrase(person.getField115(), font_ru)); } if (!person.getField116().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField116(), font_ru)); } if (!person.getField117().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField117(), font_ru)); } innertable.addCell(pr); pr = new Phrase(""); if (!person.getField118().equals("")) { pr.add(new Phrase(person.getField118(), font_ru)); } innertable.addCell(pr); pr = new Phrase(""); if (!person.getField119().equals("")) { pr.add(new Phrase(person.getField119(), font_ru)); } if (!person.getField120().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField120(), font_ru)); } if (!person.getField121().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField121(), font_ru)); } innertable.addCell(pr); pr = new Phrase(""); if (!person.getField122().equals("")) { pr.add(new Phrase(person.getField122(), font_ru)); } innertable.addCell(pr); pr = new Phrase(""); if (!person.getField123().equals("")) { pr.add(new Phrase(person.getField123(), font_ru)); } if (!person.getField124().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField124(), font_ru)); } if (!person.getField125().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField125(), font_ru)); } innertable.addCell(pr); pr = new Phrase(""); if (!person.getField126().equals("")) { pr.add(new Phrase(person.getField126(), font_ru)); } innertable.addCell(pr); tcell = new PdfPCell(innertable); tcell.setColspan(2); table1.addCell(tcell); //2.7 pr = new Phrase(rb_ch.getString("howpay"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("howpay"), font_ru)); cell1 = new PdfPCell(pr); pr = new Phrase(""); if (!person.getField127().equals("")) { pr.add(new Phrase(person.getField127(), font_ru)); } cell2 = new PdfPCell(pr); cell1.setColspan(2); table1.addCell(cell1); table1.addCell(cell2); //2.8 pr = new Phrase(rb_ch.getString("infoAboutVisit"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("infoAboutVisit"), font_ru)); cell1 = new PdfPCell(pr); cell1.setRowspan(4); table1.addCell(cell1); pr = new Phrase(rb_ch.getString("nazvanie"), font_ch); if (!person.getField128().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField128(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("nazvanie"), font_ru)); cell2 = new PdfPCell(pr); cell2.setColspan(2); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("address"), font_ch); if (!person.getField129().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField129(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("address"), font_ru)); cell2 = new PdfPCell(pr); cell2.setColspan(2); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("tel"), font_ch); if (!person.getField130().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField130(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("tel"), font_ru)); cell2 = new PdfPCell(pr); cell2.setColspan(2); table1.addCell(cell2); pr = new Phrase(rb_ch.getString("relation"), font_ch); if (!person.getField131().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField131(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("relation"), font_ru)); cell2 = new PdfPCell(pr); cell2.setColspan(2); table1.addCell(cell2); //2.9 pr = new Phrase(rb_ch.getString("oldVisa"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("oldVisa"), font_ru)); cell1 = new PdfPCell(pr); pr = new Paragraph(""); if (!person.getField132().equals("")) { pr.add(new Phrase(person.getField132(), font_ru)); } cell2 = new PdfPCell(pr); cell1.setColspan(2); table1.addCell(cell1); table1.addCell(cell2); //2.10 pr = new Phrase(rb_ch.getString("otherViseted"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("otherViseted"), font_ru)); cell1 = new PdfPCell(pr); pr = new Paragraph(""); if (!person.getField133().equals("")) { pr.add(new Phrase(person.getField133(), font_ru)); } cell2 = new PdfPCell(pr); cell1.setColspan(2); table1.addCell(cell1); table1.addCell(cell2); // tcell = new PdfPCell(table1); tcell.setColspan(2); basetable.addCell(tcell); ///////////////////////////////////// document.add(basetable); ///////////////////////////////////////part3 pr = new Phrase("\n"); pr.add(new Phrase(rb_ch.getString("part3"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("part3"), font_ru)); pr.add(new Phrase("\n")); document.add(pr); //3.1 basetable = new PdfPTable(2); basetable.setWidthPercentage(100); table1 = new PdfPTable(4); table1.setWidths(new int[] { 1, 1, 1, 1 }); pr = new Phrase(rb_ch.getString("wrongVisit"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("wrongVisit"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(3); table1.addCell(cell1); pr = new Phrase(""); if (!person.getField134().equals("")) { pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } if (!person.getField135().equals("")) { pr.add(new Phrase(rb_ch.getString("no"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("no"), font_ru)); } cell2 = new PdfPCell(pr); table1.addCell(cell2); //3.2 pr = new Phrase(rb_ch.getString("rejectedVisit"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("rejectedVisit"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(3); table1.addCell(cell1); pr = new Phrase(""); if (!person.getField136().equals("")) { pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } if (!person.getField137().equals("")) { pr.add(new Phrase(rb_ch.getString("no"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("no"), font_ru)); } cell2 = new PdfPCell(pr); table1.addCell(cell2); //3.3 pr = new Phrase(rb_ch.getString("sudimost"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("sudimost"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(3); table1.addCell(cell1); pr = new Phrase(""); if (!person.getField138().equals("")) { pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } if (!person.getField139().equals("")) { pr.add(new Phrase(rb_ch.getString("no"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("no"), font_ru)); } cell2 = new PdfPCell(pr); table1.addCell(cell2); //3.4 pr = new Phrase(rb_ch.getString("illness"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("illness"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(3); table1.addCell(cell1); pr = new Phrase(""); if (!person.getField140().equals("")) { pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } if (!person.getField141().equals("")) { pr.add(new Phrase(rb_ch.getString("no"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("no"), font_ru)); } cell2 = new PdfPCell(pr); table1.addCell(cell2); //3.5 pr = new Phrase(rb_ch.getString("ilnessContry"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("ilnessContry"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(3); table1.addCell(cell1); pr = new Phrase(""); if (!person.getField142().equals("")) { pr.add(new Phrase(rb_ch.getString("yes"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("yes"), font_ru)); } if (!person.getField143().equals("")) { pr.add(new Phrase(rb_ch.getString("no"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("no"), font_ru)); } cell2 = new PdfPCell(pr); table1.addCell(cell2); //3.6 pr = new Phrase(rb_ch.getString("ilnessContryMoreDesc"), font_ch); if (!person.getField145().equals("")) { pr.add(new Phrase(person.getField145(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("ilnessContryMoreDesc"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(4); table1.addCell(cell1); //3.7 pr = new Phrase(rb_ch.getString("ilnessContryOtherDesc"), font_ch); if (!person.getField146().equals("")) { pr.add(new Phrase(person.getField146(), font_ru)); } pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("ilnessContryOtherDesc"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(4); table1.addCell(cell1); //3.8 pr = new Phrase(rb_ch.getString("ilnessContryPersonData"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("ilnessContryPersonData"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(4); table1.addCell(cell1); //3.8.1 pr = new Phrase(rb_ch.getString("info"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("info"), font_ru)); pr.add(new Phrase("\n")); cell1 = new PdfPCell(pr); table1.addCell(cell1); //3.8.2 pr = new Phrase(rb_ch.getString("person1"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("person1"), font_ru)); pr.add(new Phrase("\n")); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ch.getString("photo"), font_ch)); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("photo"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); //3.8.3 pr = new Phrase(rb_ch.getString("person2"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("person2"), font_ru)); pr.add(new Phrase("\n")); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ch.getString("photo"), font_ch)); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("photo"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); //3.8.4 pr = new Phrase(rb_ch.getString("person3"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("person3"), font_ru)); pr.add(new Phrase("\n")); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ch.getString("photo"), font_ch)); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("photo"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); //3.8.body //for(int i = 1; i< 4; i++){ //fio pr = new Phrase(rb_ch.getString("part3.8_1"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part3.8_1"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(); if (!person.getField147().equals("")) { pr.add(new Phrase(person.getField147(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(); if (!person.getField148().equals("")) { pr.add(new Phrase(person.getField148(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(); if (!person.getField149().equals("")) { pr.add(new Phrase(person.getField149(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); //sex pr = new Phrase(rb_ch.getString("part3.8_2"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part3.8_2"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(); if (!person.getField150().equals("")) { pr.add(new Phrase(person.getField150(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(); if (!person.getField151().equals("")) { pr.add(new Phrase(person.getField151(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(); if (!person.getField152().equals("")) { pr.add(new Phrase(person.getField152(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); // pr = new Phrase(rb_ch.getString("part3.8_3"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part3.8_3"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(""); if (!person.getField153().equals("")) { pr.add(new Phrase(person.getField153(), font_ru)); } if (!person.getField154().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField154(), font_ru)); } if (!person.getField155().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField155(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(""); if (!person.getField156().equals("")) { pr.add(new Phrase(person.getField156(), font_ru)); } if (!person.getField157().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField157(), font_ru)); } if (!person.getField158().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField158(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(""); if (!person.getField159().equals("")) { pr.add(new Phrase(person.getField159(), font_ru)); } if (!person.getField160().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField160(), font_ru)); } if (!person.getField161().equals("")) { pr.add(new Phrase("/")); pr.add(new Phrase(person.getField161(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); //} tcell = new PdfPCell(table1); tcell.setColspan(2); basetable.addCell(tcell); document.add(basetable); //////////////////////////////////////part4 pr = new Phrase("\n"); pr.add(new Phrase(rb_ch.getString("part4"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("part4"), font_ru)); pr.add(new Phrase("\n")); document.add(pr); //4.1 basetable = new PdfPTable(2); basetable.setWidthPercentage(100); table1 = new PdfPTable(2); table1.setWidths(new int[] { 1, 1 }); pr = new Phrase(rb_ch.getString("part4.1"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part4.1"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(2); table1.addCell(cell1); //4.2 pr = new Phrase(rb_ch.getString("part4.2"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part4.2"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(2); table1.addCell(cell1); //4.3 pr = new Phrase(rb_ch.getString("part4.3"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part4.3"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(2); table1.addCell(cell1); //4.4 pr = new Phrase(rb_ch.getString("part4.4"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part4.4"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(rb_ch.getString("part4.5"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part4.5"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); //4.5 pr = new Phrase(rb_ch.getString("part4.5"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part4.5"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(2); table1.addCell(cell1); // tcell = new PdfPCell(table1); tcell.setColspan(2); basetable.addCell(tcell); // document.add(basetable); //////////////////////////////////////part5 pr = new Phrase("\n"); pr.add(new Phrase(rb_ch.getString("part5"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("part5"), font_ru)); pr.add(new Phrase("\n")); document.add(pr); basetable = new PdfPTable(2); basetable.setWidthPercentage(100); table1 = new PdfPTable(4); table1.setWidths(new int[] { 1, 1, 1, 1 }); //5.1 5.2 pr = new Phrase(rb_ch.getString("part5.1"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("part5.1"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(); if (!person.getField162().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField162(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(rb_ch.getString("part5.2"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part5.2"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(); if (!person.getField163().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField163(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); //5.3 5.4 pr = new Phrase(rb_ch.getString("part5.3"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part5.3"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(); if (!person.getField164().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField164(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(rb_ch.getString("part5.4"), font_ch); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ru.getString("part5.4"), font_ru)); cell1 = new PdfPCell(pr); table1.addCell(cell1); pr = new Phrase(); if (!person.getField165().equals("")) { pr.add(new Phrase(" ")); pr.add(new Phrase(person.getField165(), font_ru)); } cell1 = new PdfPCell(pr); table1.addCell(cell1); //5.5 pr = new Phrase(rb_ch.getString("part5.5"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("part5.5"), font_ru)); pr.add(new Phrase("\n")); pr.add(new Phrase(rb_ch.getString("part5.5.1"), font_ch)); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("part5.5.1"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(4); table1.addCell(cell1); //5.5 pr = new Phrase(rb_ch.getString("part5.6"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("part5.6"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(2); table1.addCell(cell1); pr = new Phrase(rb_ch.getString("part5.7"), font_ch); pr.add(new Phrase(" ")); pr.add(new Phrase(rb_ru.getString("part5.7"), font_ru)); cell1 = new PdfPCell(pr); cell1.setColspan(2); table1.addCell(cell1); // tcell = new PdfPCell(table1); tcell.setColspan(2); basetable.addCell(tcell); ///////////////////////////////////// document.add(basetable); } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); } // step 5 document.close(); // }
From source file:mkl.testarea.itext5.pdfcleanup.StrictPdfCleanUpProcessor.java
License:Open Source License
private Font retrieveFontFromAcroForm(PdfName fontName, PdfNumber size) { PdfIndirectReference fontIndirReference = pdfStamper.getReader().getAcroForm().getAsDict(PdfName.DR) .getAsDict(PdfName.FONT).getAsIndirectObject(fontName); BaseFont bfont = BaseFont.createFont((PRIndirectReference) fontIndirReference); return new Font(bfont, size.floatValue()); }