List of usage examples for com.lowagie.text Rectangle NO_BORDER
int NO_BORDER
To view the source code for com.lowagie.text Rectangle NO_BORDER.
Click Source Link
From source file:com.prime.report.template.TableHeader.java
/** * Adds a header to every page/*from www. j a va 2s.co m*/ * * @param writer * @param document * @see com.itextpdf.text.pdf.PdfPageEventHelper#onEndPage( * com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document) */ @Override public void onEndPage(PdfWriter writer, Document document) { PdfPTable table = new PdfPTable(4); try { table.setWidths(new int[] { 10, 11, 9, 1 }); table.setTotalWidth(527); table.setLockedWidth(true); table.getDefaultCell().setFixedHeight(20); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); String logoPath = "/resources/image/logo.png"; ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext(); String logo = servletContext.getRealPath(logoPath); Image img = Image.getInstance(logo); table.addCell(Image.getInstance(img)); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(new Phrase("New South West Facility Center", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLDITALIC, Color.BLACK))); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(String.format("Page %d of", writer.getPageNumber())); PdfPCell cell = new PdfPCell(Image.getInstance(total)); cell.setBorder(Rectangle.NO_BORDER); table.addCell(cell); table.writeSelectedRows(0, -1, 34, 803, writer.getDirectContent()); } catch (DocumentException de) { throw new ExceptionConverter(de); } catch (IOException ex) { Logger.getLogger(TableHeader.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.qcadoo.mes.costCalculation.print.CostCalculationPdfService.java
License:Open Source License
@Override protected void buildPdfContent(final Document document, final Entity entity, final Locale locale) throws DocumentException { String documentTitle = translationService.translate("costCalculation.costCalculationDetails.report.title", locale);// ww w .j a va 2 s . c om String documentAuthor = translationService.translate("qcadooReport.commons.generatedBy.label", locale); pdfHelper.addDocumentHeader(document, "", documentTitle, documentAuthor, new Date()); DataDefinition dataDefCostCalculation = dataDefinitionService .get(CostCalculationConstants.PLUGIN_IDENTIFIER, CostCalculationConstants.MODEL_COST_CALCULATION); Entity costCalculation = dataDefCostCalculation.find("where id = " + entity.getId().toString()) .uniqueResult(); PdfPTable leftPanelColumn = addLeftPanelToReport(costCalculation, locale); PdfPTable rightPanelColumn = addRightPanelToReport(costCalculation, locale); PdfPTable panelTable = pdfHelper.createPanelTable(2); panelTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); panelTable.addCell(leftPanelColumn); panelTable.addCell(rightPanelColumn); panelTable.setSpacingAfter(20); panelTable.setSpacingBefore(20); panelTable.setTableEvent(null); panelTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); document.add(panelTable); document.add(new Paragraph( translationService.translate("costCalculation.costCalculationDetails.report.paragraph", locale), FontUtils.getDejavuBold11Dark())); PdfPTable materialsTable = addMaterialsTable(costCalculation, locale); document.add(materialsTable); document.add(Chunk.NEWLINE); document.add(new Paragraph( translationService.translate("costCalculation.costCalculationDetails.report.paragraph2", locale), FontUtils.getDejavuBold11Dark())); CalculateOperationCostMode calculateOperationCostMode = CalculateOperationCostMode .parseString(costCalculation.getStringField(CostCalculationFields.CALCULATE_OPERATION_COSTS_MODE)); if (CalculateOperationCostMode.HOURLY.equals(calculateOperationCostMode)) { document.add(addHourlyCostsTable(costCalculation, locale)); } else if (CalculateOperationCostMode.PIECEWORK.equals(calculateOperationCostMode)) { document.add(addTableAboutPieceworkCost(costCalculation, locale)); } else { throw new IllegalStateException("Unsupported CalculateOperationCostMode"); } printMaterialAndOperationNorms(document, costCalculation, locale); }
From source file:com.qcadoo.mes.deliveries.print.DeliveryReportPdf.java
License:Open Source License
private void setSimpleFormat(final PdfPTable headerTable) { headerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); headerTable.getDefaultCell().setPadding(6.0f); headerTable.getDefaultCell().setVerticalAlignment(PdfPCell.ALIGN_TOP); }
From source file:com.qcadoo.mes.workPlans.pdf.document.operation.component.OperationBarcode.java
License:Open Source License
public void print(PdfWriter pdfWriter, Entity operationComponent, Document document) throws DocumentException { PdfContentByte cb = pdfWriter.getDirectContent(); Barcode128 code128 = new Barcode128(); code128.setCode(//from w ww. j av a 2 s .c o m barcodeOperationComponentService.getCodeFromBarcodeForOperationComponet(operationComponent)); PdfPTable barcodeTable = new PdfPTable(1); barcodeTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); barcodeTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); barcodeTable.getDefaultCell().setBorder(0); barcodeTable.setWidthPercentage(10f); barcodeTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); Image barcodeImage = code128.createImageWithBarcode(cb, null, null); barcodeTable.addCell(barcodeImage); document.add(barcodeTable); }
From source file:com.qcadoo.mes.workPlans.pdf.document.WorkPlanPdfForDivision.java
License:Open Source License
private void addWorkPlanTitle(Document document, Entity workPlan, String title, Locale locale) throws DocumentException { PdfPTable headerTable = pdfHelper.createPanelTable(2); PdfPCell titleCell = new PdfPCell(); titleCell.setBorder(Rectangle.NO_BORDER); Paragraph workPlanTitle = new Paragraph( new Phrase(getWorkPlanTitle(locale), FontUtils.getDejavuBold11Light())); workPlanTitle.add(new Phrase(" " + getWorkPlanName(workPlan), FontUtils.getDejavuBold11Dark())); titleCell.addElement(workPlanTitle); PdfPCell divisionCell = new PdfPCell(); divisionCell.setBorder(Rectangle.NO_BORDER); Paragraph divisionTitle = new Paragraph( new Phrase(getDivisionTitle(locale), FontUtils.getDejavuBold11Light())); divisionTitle.add(new Phrase(" " + getDivisionFromTitle(title, locale), FontUtils.getDejavuBold11Dark())); divisionTitle.setAlignment(Element.ALIGN_RIGHT); divisionCell.addElement(divisionTitle); headerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); headerTable.setTableEvent(null);//from ww w .ja v a 2 s . c o m headerTable.setSpacingAfter(4.0f); headerTable.addCell(titleCell); headerTable.addCell(divisionCell); document.add(headerTable); }
From source file:com.qcadoo.mes.workPlans.pdf.document.WorkPlanPdfForDivision.java
License:Open Source License
private void addOperationTable(PdfWriter pdfWriter, GroupingContainer groupingContainer, Document document, OrderOperationComponent orderOperationComponent, Locale locale) throws DocumentException { Map<Long, Map<OperationProductColumn, ColumnAlignment>> outputProductsMap = groupingContainer .getOperationComponentIdProductOutColumnToAlignment(); Map<Long, Map<OperationProductColumn, ColumnAlignment>> inputProductsMap = groupingContainer .getOperationComponentIdProductInColumnToAlignment(); Entity operationComponent = orderOperationComponent.getOperationComponent(); Entity order = orderOperationComponent.getOrder(); Entity product = order.getBelongsToField(OrderFields.PRODUCT); Map<OperationProductColumn, ColumnAlignment> inputProductColumnAlignmentMap = inputProductsMap .get(operationComponent.getId()); Map<OperationProductColumn, ColumnAlignment> outputProductColumnAlignmentMap = outputProductsMap .get(operationComponent.getId()); PdfPTable table = pdfHelper.createPanelTable(3); PdfPCell headerCell = new PdfPCell(); headerCell.setBorder(Rectangle.NO_BORDER); headerCell.setColspan(2);//from w w w . j a va 2 s. c o m PdfPCell inputCell = new PdfPCell(); inputCell.setBorder(Rectangle.NO_BORDER); PdfPCell outputCell = new PdfPCell(); outputCell.setBorder(Rectangle.NO_BORDER); PdfPCell codeCell = new PdfPCell(); codeCell.setBorder(Rectangle.NO_BORDER); codeCell.setHorizontalAlignment(Element.ALIGN_CENTER); codeCell.setVerticalAlignment(Element.ALIGN_TOP); codeCell.setRowspan(2); // addOperationSummary(headerCell, operationComponent); addOrderSummary(headerCell, order, product, operationComponent); addOperationProductsTable(inputCell, operationProductInComponents(operationComponent, order), inputProductColumnAlignmentMap, ProductDirection.IN, locale); addOperationProductsTable(outputCell, operationProductOutComponents(operationComponent, order), outputProductColumnAlignmentMap, ProductDirection.OUT, locale); codeCell.addElement(createBarcode(pdfWriter, operationComponent)); float[] tableColumnWidths = new float[] { 70f, 70f, 10f }; table.setWidths(tableColumnWidths); table.setTableEvent(null); table.addCell(headerCell); table.addCell(codeCell); table.addCell(inputCell); table.addCell(outputCell); table.setKeepTogether(true); document.add(table); }
From source file:com.qcadoo.mes.workPlans.pdf.document.WorkPlanPdfForDivision.java
License:Open Source License
private void addOperationSummary(PdfPCell cell, Entity operationComponent) throws DocumentException { Entity operation = operationComponent.getBelongsToField(TechnologyOperationComponentFields.OPERATION); PdfPTable operationTable = pdfHelper.createPanelTable(1); PdfPCell numberCell = new PdfPCell(); numberCell.setBorder(Rectangle.NO_BORDER); Paragraph operationName = new Paragraph(operation.getStringField(OperationFields.NUMBER) + " - " + operation.getStringField(OperationFields.NAME), FontUtils.getDejavuBold7Dark()); numberCell.addElement(operationName); PdfPCell descriptionCell = new PdfPCell(); descriptionCell.setBorder(Rectangle.NO_BORDER); String comment = operation.getStringField(OperationFields.COMMENT); Paragraph description = null;//w ww . jav a 2 s .co m if (!StringUtils.isEmpty(comment)) { description = new Paragraph(comment, FontUtils.getDejavuBold7Dark()); } operationTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); operationTable.setTableEvent(null); operationTable.addCell(numberCell); if (description != null) { descriptionCell.addElement(description); operationTable.addCell(descriptionCell); } else { operationTable.addCell(""); } cell.addElement(operationTable); }
From source file:com.qcadoo.mes.workPlans.pdf.document.WorkPlanPdfForDivision.java
License:Open Source License
private void addOrderSummary(PdfPCell cell, Entity order, Entity product, Entity operationComponent) throws DocumentException { Entity operation = operationComponent.getBelongsToField(TechnologyOperationComponentFields.OPERATION); PdfPTable orderTable = pdfHelper.createPanelTable(3); PdfPCell operationCell = new PdfPCell(); operationCell.setBorder(Rectangle.NO_BORDER); Paragraph operationName = new Paragraph(operation.getStringField(OperationFields.NUMBER) + " - " + operation.getStringField(OperationFields.NAME), FontUtils.getDejavuBold7Dark()); operationCell.addElement(operationName); PdfPCell numberCell = new PdfPCell(); numberCell.setBorder(Rectangle.NO_BORDER); Paragraph number = new Paragraph(order.getStringField(OrderFields.NUMBER), FontUtils.getDejavuBold7Dark()); number.setAlignment(Element.ALIGN_RIGHT); numberCell.addElement(number);//from ww w . j ava 2s . c om PdfPCell quantityCell = new PdfPCell(); quantityCell.setBorder(Rectangle.NO_BORDER); Paragraph quantity = new Paragraph( numberService.formatWithMinimumFractionDigits(order.getDecimalField(OrderFields.PLANNED_QUANTITY), 0) + " " + product.getStringField(ProductFields.UNIT), FontUtils.getDejavuBold7Dark()); quantity.setAlignment(Element.ALIGN_CENTER); quantityCell.addElement(quantity); PdfPCell descriptionCell = new PdfPCell(); descriptionCell.setBorder(Rectangle.NO_BORDER); descriptionCell.setColspan(3); String comment = operationComponent.getStringField(TechnologyOperationComponentFields.COMMENT); Paragraph description = null; if (!StringUtils.isEmpty(comment)) { description = new Paragraph(comment, FontUtils.getDejavuBold7Dark()); } float[] tableColumnWidths = new float[] { 160f, 30f, 10f }; orderTable.setWidths(tableColumnWidths); orderTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); orderTable.setTableEvent(null); orderTable.addCell(operationCell); orderTable.addCell(numberCell); orderTable.addCell(quantityCell); if (description != null) { descriptionCell.addElement(description); orderTable.addCell(descriptionCell); } cell.addElement(orderTable); }
From source file:com.qcadoo.report.internal.PdfHelperImpl.java
License:Open Source License
@Override public PdfPTable createPanelTable(final int column) { PdfPTable mainData = new PdfPTable(column); mainData.setWidthPercentage(100f);/*from w ww. ja va 2s .c o m*/ mainData.getDefaultCell().setBorder(Rectangle.NO_BORDER); mainData.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP); mainData.getDefaultCell().setPadding(4.0f); mainData.setTableEvent(new TableBorderEvent()); return mainData; }
From source file:com.qcadoo.report.internal.PdfHelperImpl.java
License:Open Source License
@Override public PdfPTable createPanelTableWithSimpleFormat(final int column) { PdfPTable pdfPTable = new PdfPTable(column); pdfPTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); pdfPTable.getDefaultCell().setPadding(6.0f); pdfPTable.getDefaultCell().setVerticalAlignment(PdfPCell.ALIGN_TOP); return pdfPTable; }