Search in sources :

Example 16 with Cell

use of com.itextpdf.layout.element.Cell in project betca-tpv-spring by miw-upm.

the class PdfTicketBuilder method tableColspanRight.

public PdfTicketBuilder tableColspanRight(String value) {
    Cell cell = new Cell(1, this.getTable().getNumberOfColumns());
    cell.setTextAlignment(TextAlignment.RIGHT).setBold().setFontSize(TERMIC_FONT_SIZE_EMPHASIZEDD);
    cell.add(value);
    this.getTable().addCell(cell);
    this.getDocument().add(this.getTable());
    return this;
}
Also used : Cell(com.itextpdf.layout.element.Cell)

Example 17 with Cell

use of com.itextpdf.layout.element.Cell in project betca-tpv-spring by miw-upm.

the class PdfTag24Builder method build.

public Optional<byte[]> build() {
    while (tag24 % 3 != 0) {
        Cell cell = new Cell();
        cell.setBorder(Border.NO_BORDER);
        this.getTable().addCell(cell);
        this.getDocument().add(this.getTable());
        tag24++;
    }
    this.getDocument().close();
    try {
        return Optional.of(Files.readAllBytes(new File(this.getFullPath()).toPath()));
    } catch (IOException ioe) {
        Logger.getLogger(this.getClass()).error("IO: " + ioe);
    }
    return Optional.empty();
}
Also used : IOException(java.io.IOException) Cell(com.itextpdf.layout.element.Cell) File(java.io.File)

Example 18 with Cell

use of com.itextpdf.layout.element.Cell in project ComponentManagement by Bac3Phi.

the class InventoriesReportController method addTableInventories.

private void addTableInventories(Document document) throws SQLException {
    float[] pointColumnWidths = { 200F, 200F, 200F, 200F, 200F };
    Table table = new Table(pointColumnWidths);
    table.addCell(new Cell().add("Mã Chi Tiết Hàng Tồn").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    table.addCell(new Cell().add("Tên Mặt Hàng").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    table.addCell(new Cell().add("Lượng Nhập").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    table.addCell(new Cell().add("Lượng Bán").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    table.addCell(new Cell().add("Lượng Tồn").setTextAlignment(TextAlignment.CENTER).setFontSize(14));
    resultSet = dbConn.getData("SELECT CTBCHT.MaCTBC, MH.TenMH, SUM(CTPN.SoLuong) AS LuongNhapBĐ, SUM(CTHD.SoLuong) AS LuongBan, SUM(MH.SoLuong) AS LuongTon FROM CHITIETBAOCAOHANGTON CTBCHT JOIN MATHANG MH JOIN CHITIETPHIEUNHAP CTPN JOIN CHITIETHOADON CTHD ON CTBCHT.MaMH = MH.MaMH AND CTPN.MaMH = CTBCHT.MaMH AND CTHD.MaMH = CTBCHT.MaMH WHERE MaBCHT = '" + txtReportID.getText() + "'" + "GROUP BY TenMH;");
    while (resultSet.next()) {
        table.addCell(new Cell().add(resultSet.getString("MaCTBC")).setTextAlignment(TextAlignment.LEFT).setFontSize(12));
        table.addCell(new Cell().add(resultSet.getString("TenMH")).setTextAlignment(TextAlignment.LEFT).setFontSize(12));
        table.addCell(new Cell().add(String.valueOf(resultSet.getLong("LuongNhapBĐ"))).setTextAlignment(TextAlignment.RIGHT).setFontSize(12));
        table.addCell(new Cell().add(String.valueOf(resultSet.getLong("LuongBan"))).setTextAlignment(TextAlignment.RIGHT).setFontSize(12));
        table.addCell(new Cell().add(String.valueOf(resultSet.getLong("LuongTon"))).setTextAlignment(TextAlignment.RIGHT).setFontSize(12));
    }
    document.add(table);
}
Also used : Table(com.itextpdf.layout.element.Table) Cell(com.itextpdf.layout.element.Cell)

Example 19 with Cell

use of com.itextpdf.layout.element.Cell in project MtgDesktopCompanion by nicho92.

the class PDFExport method createCell.

private Cell createCell(MagicCard card) throws IOException {
    ImageData imageData = null;
    try {
        imageData = ImageDataFactory.create(getEnabledPlugin(MTGPictureProvider.class).getFullSizePicture(card), null);
    } catch (Exception e) {
        imageData = ImageDataFactory.create(getEnabledPlugin(MTGPictureProvider.class).getBackPicture(), null);
    }
    var image = new Image(imageData);
    image.scaleAbsolute(2.49f * userPoint, 3.48f * userPoint);
    var cell = new Cell();
    if (getBoolean("PRINT_CUT_LINE")) {
        cell.setBorder(new DottedBorder(0.5f));
    } else
        cell.setBorder(Border.NO_BORDER);
    if (getInt(SPACE) != null)
        cell.setPadding(getInt(SPACE));
    cell.add(image);
    return cell;
}
Also used : MTGPictureProvider(org.magic.api.interfaces.MTGPictureProvider) ImageData(com.itextpdf.io.image.ImageData) Image(com.itextpdf.layout.element.Image) DottedBorder(com.itextpdf.layout.borders.DottedBorder) Cell(com.itextpdf.layout.element.Cell) NotImplementedException(org.apache.commons.lang3.NotImplementedException) IOException(java.io.IOException)

Example 20 with Cell

use of com.itextpdf.layout.element.Cell in project betca-tpv-spring by miw-upm.

the class PdfTag24Builder method addTag24.

public PdfTag24Builder addTag24(String description, String code) {
    assert description != null;
    assert code != null;
    if ((tag24 % 24) == 0) {
        if (tag24 > 0) {
            this.getDocument().add(new AreaBreak(AreaBreakType.NEXT_PAGE));
        }
        this.prepareTags24();
    }
    Cell cell = new Cell();
    cell.setPaddingTop(10);
    cell.setMinHeight(84.2F);
    cell.setBorder(Border.NO_BORDER);
    cell.setTextAlignment(TextAlignment.CENTER);
    cell.add(description);
    if (!code.isEmpty()) {
        BarcodeEAN barcode = new BarcodeEAN(this.getDocument().getPdfDocument());
        barcode.setCodeType(BarcodeEAN.EAN13);
        barcode.setCode(code.trim());
        Image barcodeImage = new Image(barcode.createFormXObject(this.getDocument().getPdfDocument()));
        barcodeImage.setWidthPercent(70);
        barcodeImage.setHorizontalAlignment(HorizontalAlignment.CENTER);
        cell.add(barcodeImage);
    }
    this.getTable().addCell(cell);
    this.getDocument().add(this.getTable());
    tag24++;
    return this;
}
Also used : BarcodeEAN(com.itextpdf.barcodes.BarcodeEAN) AreaBreak(com.itextpdf.layout.element.AreaBreak) Image(com.itextpdf.layout.element.Image) Cell(com.itextpdf.layout.element.Cell)

Aggregations

Cell (com.itextpdf.layout.element.Cell)34 Table (com.itextpdf.layout.element.Table)29 PdfDocument (com.itextpdf.kernel.pdf.PdfDocument)21 PdfWriter (com.itextpdf.kernel.pdf.PdfWriter)21 Document (com.itextpdf.layout.Document)21 Paragraph (com.itextpdf.layout.element.Paragraph)21 CsvTo2DList (com.itextpdf.highlevel.util.CsvTo2DList)6 List (java.util.List)6 Image (com.itextpdf.layout.element.Image)4 DottedBorder (com.itextpdf.layout.borders.DottedBorder)3 SolidBorder (com.itextpdf.layout.borders.SolidBorder)3 IOException (java.io.IOException)3 DashedBorder (com.itextpdf.layout.borders.DashedBorder)2 File (java.io.File)2 BarcodeEAN (com.itextpdf.barcodes.BarcodeEAN)1 ImageData (com.itextpdf.io.image.ImageData)1 PdfFont (com.itextpdf.kernel.font.PdfFont)1 Style (com.itextpdf.layout.Style)1 AreaBreak (com.itextpdf.layout.element.AreaBreak)1 Link (com.itextpdf.layout.element.Link)1