List of usage examples for com.itextpdf.text Element ALIGN_CENTER
int ALIGN_CENTER
To view the source code for com.itextpdf.text Element ALIGN_CENTER.
Click Source Link
From source file:com.photoshop.misc.Indexkaartgenerator.java
private void createTable(Paragraph preface) throws BadElementException, DocumentException { // create header cell PdfPTable table = new PdfPTable(4); // set the width of the table to 100% of page table.setWidthPercentage(100);//from w ww.j a v a 2 s .co m table.setWidths(new float[] { 1f, 0.6f, 0.4f, 2f }); table.setHeaderRows(1); creatCell("Voorbeeld foto", table, true); creatCell("Aantal", table, true); creatCell("PhotoID", table, true); creatCell("Beschrijving", table, true); for (OrderRow row : order.getOrderRows()) { Photo pfdphoto = this.photoDao.getById(row.getPhoto_id()); Image Logo = null; try { String filename = env.getProperty("uploadDir") + "thumb/" + pfdphoto.getThumbnailURL(); Logo = Image.getInstance(filename); Logo.scaleAbsolute(75, 50); } catch (BadElementException | IOException ex) { Logger.getLogger(OrderController.class.getName()).log(Level.SEVERE, null, ex); } PdfPCell c1 = new PdfPCell(Logo); c1.setHorizontalAlignment(Element.ALIGN_CENTER); c1.setPaddingTop(10); c1.setPaddingBottom(10); table.addCell(c1); creatCell(row.getAantal() + "", table, false); creatCell(row.getPhoto_id() + "", table, false); creatCell(row.getProduct().getName(), table, false); } preface.add(table); }
From source file:com.planfeed.others.HeaderFooter.java
License:Apache License
public void onEndPage(PdfWriter writer, Document document) { Rectangle rect = writer.getBoxSize("art"); ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_RIGHT, header, rect.getRight(), rect.getTop(), 0);//w w w. j av a2 s. c o m ColumnText.showTextAligned(writer.getDirectContent(), Element.ALIGN_CENTER, new Phrase(String.format("page %d", pagenumber)), (rect.getLeft() + rect.getRight()) / 2, rect.getBottom() - 18, 0); }
From source file:com.planfeed.services.MeetingServiceImpl.java
License:Apache License
public ByteArrayOutputStream getActa(String meetingId) throws Exception { Meeting meeting;/*from w w w. j a v a2 s. co m*/ try { meeting = this.getMeeting(meetingId); } catch (Exception e) { throw new MeetingNotFound(); } Document document = new Document(); ByteArrayOutputStream baosPDF = new ByteArrayOutputStream(); PdfWriter docWriter = null; HeaderFooter event = new HeaderFooter(meeting.getDate()); docWriter = PdfWriter.getInstance(document, baosPDF); docWriter.setBoxSize("art", new Rectangle(36, 54, 559, 788)); docWriter.setPageEvent(event); document.open(); //metadata document.addTitle(meeting.getTitle() + " Acta"); document.add(new Paragraph(" ")); //Title Paragraph title = new Paragraph("Acta of " + meeting.getTitle(), titleFont); title.setAlignment(Element.ALIGN_CENTER); addEmptyLine(title, 1); document.add(title); //Description Paragraph descriptionPar = new Paragraph(); descriptionPar.add(new Paragraph("Description", titlePointFont)); descriptionPar.add(new Paragraph(meeting.getDescription(), textFont)); addEmptyLine(descriptionPar, 1); document.add(descriptionPar); //Points int index = 1; for (PointOfAgenda point : meeting.getAgenda()) { Paragraph pointPar = new Paragraph(); pointPar.add(new Paragraph(index + ". " + point.getName(), titlePointFont)); pointPar.add(new Paragraph(point.getComment(), textFont)); addEmptyLine(pointPar, 2); document.add(pointPar); index += 1; } document.close(); return baosPDF; }
From source file:com.planning.project.controller.CreatePDF.java
private static void addTitlePage(Document document) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(24);/*from w w w . ja va2 s.c o m*/ String imagepath = "src/main/webapp/resources/images/curt.gif"; Image img = Image.getInstance(imagepath); img.scaleToFit(70f, 70f); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy"); Paragraph created = new Paragraph(); created.setFont(TIME_ROMAN_SMALL); created.add("Report created on " + simpleDateFormat.format(new Date())); created.setAlignment(Element.ALIGN_RIGHT); Paragraph logo = new Paragraph(); logo.setFont(TIME_ROMAN_SMALL); logo.add(img); logo.setAlignment(Element.ALIGN_LEFT); document.add(created); document.add(logo); // Paragraph created = new Paragraph(); // created.setFont(TIME_ROMAN_SMALL); // created.add("Report created on " + simpleDateFormat.format(new // Date())); // created.setAlignment(Element.ALIGN_RIGHT); Paragraph paragraph = new Paragraph(); paragraph.setFont(font); paragraph.add("FormProject "); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); creteEmptyLine(created, 1); }
From source file:com.planning.project.controller.CreatePDF.java
private static void createTable(Document document) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);//from w w w .java2 s.com Paragraph paragraph = new Paragraph(); paragraph.setFont(font); creteEmptyLine(paragraph, 2); document.add(paragraph); PdfPTable table = new PdfPTable(7); paragraph.add(""); PdfPCell c1 = new PdfPCell(new Phrase("asasas", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("/?", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("?", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); TbActivity ac = new TbActivity(); c1 = new PdfPCell(new Phrase("", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); c1 = new PdfPCell(new Phrase("", font)); c1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(c1); table.setHeaderRows(1); paragraph.add(""); for (int i = 0; i < 7; i++) { table.setWidthPercentage(100); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(paragraph); } document.add(table); }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableTargetGroup(TbTargetgroup targetGroup) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);// w w w . j a v a 2 s . c om PdfPTable table = new PdfPTable(3); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("? ", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?()", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase( " ()", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutMana(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinMana(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutTeach(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinTeach(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutEmp(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinEmp(), font))); table.addCell(new PdfPCell(new Phrase("??", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutStu(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinStu(), font))); table.addCell(new PdfPCell(new Phrase("/?", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutCommu(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinCommu(), font))); table.addCell( new PdfPCell(new Phrase("?/?", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutDisable(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinDisable(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJooutOther(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinOther(), font))); return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableTargetGroup2(TbTargetgroup targetGroup) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);//from www .j ava 2 s .c o m PdfPTable table = new PdfPTable(3); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase("?", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?()", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase( " ()", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutMana(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActinMana(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutTeach(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActinTeach(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutEmp(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActinEmp(), font))); table.addCell(new PdfPCell(new Phrase("??", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutStu(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getJoinStu(), font))); table.addCell(new PdfPCell(new Phrase("?", font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActoutLect(), font))); table.addCell(new PdfPCell(new Phrase(targetGroup.getActinLect(), font))); return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtableFollowCheck(TbFormSubproject subProject) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);/*w w w . j a va 2s. com*/ PdfPTable table = new PdfPTable(3); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "?? (C_Check)", font)); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase( "??", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("?", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.addCell(new PdfPCell(new Phrase( "????", font))); table.addCell(new PdfPCell(new Phrase(subProject.getFollowCCheckTool(), font))); table.addCell(new PdfPCell(new Phrase(subProject.getFollowCCheckTime(), font))); table.addCell(new PdfPCell(new Phrase( "??", font))); table.addCell(new PdfPCell(new Phrase(subProject.getAssesCCheckTool(), font))); table.addCell(new PdfPCell(new Phrase(subProject.getAssesCCheckTime(), font))); table.addCell(new PdfPCell(new Phrase( "?? /", font))); table.addCell(new PdfPCell(new Phrase(subProject.getFollowInCCheckTool(), font))); table.addCell(new PdfPCell(new Phrase(subProject.getFollowInCCheckTime(), font))); return table; }
From source file:com.planning.project.controller.CreatePDF.java
public static PdfPTable createtablePro(TbFormProject tbFormProject) throws DocumentException, Exception { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(16);/*from w ww.java2 s . c om*/ PdfPTable table = new PdfPTable(5); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE); PdfPCell cell = new PdfPCell(new Phrase( "/ :/", font)); cell.setColspan(5); table.addCell(cell); cell = new PdfPCell( new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("", font)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getProQuantitative(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getProQualitative(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getProTiming(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getProCost(), font))); table.addCell(new PdfPCell(new Phrase("", font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsQuantitative(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsQualtitative(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsTiming(), font))); table.addCell(new PdfPCell(new Phrase(tbFormProject.getAnsCost(), font))); return table; }
From source file:com.planning.project.controller.CreatePDF.java
private static void addTitlePageProject(Document document) throws DocumentException, IOException { Font font = new Font(BaseFont.createFont("D:/THSarabunNew.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED)); font.setSize(24);//from www.ja v a 2s . co m String imagepath = "src/main/webapp/resources/images/logo.jpg"; Image img = Image.getInstance(imagepath); img.scaleToFit(70f, 70f); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy"); Paragraph created = new Paragraph(); created.setFont(TIME_ROMAN_SMALL); created.add("Report created on " + simpleDateFormat.format(new Date())); created.setAlignment(Element.ALIGN_RIGHT); Paragraph logo = new Paragraph(); logo.setFont(TIME_ROMAN_SMALL); logo.add(img); logo.setAlignment(Element.ALIGN_LEFT); document.add(created); document.add(logo); // Paragraph created = new Paragraph(); // created.setFont(TIME_ROMAN_SMALL); // created.add("Report created on " + simpleDateFormat.format(new // Date())); // created.setAlignment(Element.ALIGN_RIGHT); Paragraph paragraph = new Paragraph(); paragraph.setFont(font); paragraph.add( "??"); paragraph.setAlignment(Element.ALIGN_CENTER); document.add(paragraph); creteEmptyLine(created, 1); }