Example usage for com.lowagie.text.pdf PdfPCell setHorizontalAlignment

List of usage examples for com.lowagie.text.pdf PdfPCell setHorizontalAlignment

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfPCell setHorizontalAlignment.

Prototype

public void setHorizontalAlignment(int horizontalAlignment) 

Source Link

Document

Sets the horizontal alignment for the cell.

Usage

From source file:net.bull.javamelody.internal.web.pdf.PdfThreadInformationsReport.java

License:Apache License

private void writeThreadInformations(ThreadInformations threadInformations)
        throws DocumentException, IOException {
    final PdfPCell defaultCell = getDefaultCell();
    defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    addCell(threadInformations.getName());
    defaultCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    if (threadInformations.isDaemon()) {
        addCell(getString("oui"));
    } else {/*w w  w  .  j  av a 2 s  . c om*/
        addCell(getString("non"));
    }
    defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    addCell(integerFormat.format(threadInformations.getPriority()));
    defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    final PdfPCell cell = new PdfPCell();
    final Paragraph paragraph = new Paragraph(getDefaultCell().getLeading() + cellFont.getSize());
    paragraph.add(new Chunk(
            getImage("bullets/" + HtmlThreadInformationsReport.getStateIcon(threadInformations)), 0, -1));
    paragraph.add(new Phrase(String.valueOf(threadInformations.getState()), cellFont));
    cell.addElement(paragraph);
    addCell(cell);
    if (stackTraceEnabled) {
        addCell(threadInformations.getExecutedMethod());
    }
    if (cpuTimeEnabled) {
        defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        addCell(integerFormat.format(threadInformations.getCpuTimeMillis()));
        addCell(integerFormat.format(threadInformations.getUserTimeMillis()));
    }
}

From source file:net.bull.javamelody.PdfDatabaseInformationsReport.java

License:Apache License

private void writeRow(String[] row) {
    final PdfPCell defaultCell = getDefaultCell();
    defaultCell.setVerticalAlignment(Element.ALIGN_TOP);
    for (final String value : row) {
        if (value == null || value.length() == 0) {
            addCell("");
        } else {//from   www. j  a va 2 s.co  m
            if (isNumber(value)) {
                defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            } else {
                defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
            }
            addCell(value);
        }
    }
}

From source file:net.bull.javamelody.PdfRequestAndGraphDetailReport.java

License:Apache License

private void writeRequestValues(CounterRequest aRequest, boolean allChildHitsDisplayed) {
    final PdfPCell defaultCell = getDefaultCell();
    defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    addCell(integerFormat.format(aRequest.getMean()));
    addCell(integerFormat.format(aRequest.getMaximum()));
    addCell(integerFormat.format(aRequest.getStandardDeviation()));
    if (aRequest.getCpuTimeMean() >= 0) {
        addCell(integerFormat.format(aRequest.getCpuTimeMean()));
    } else {//from   w w  w.j a  va  2s . c o  m
        addCell("");
    }
    addCell(systemErrorFormat.format(aRequest.getSystemErrorPercentage()));
    if (allChildHitsDisplayed) {
        final boolean childHitsDisplayed = aRequest.hasChildHits();
        if (childHitsDisplayed) {
            addCell(integerFormat.format(aRequest.getChildHitsMean()));
        } else {
            addCell("");
        }
        if (childHitsDisplayed) {
            addCell(integerFormat.format(aRequest.getChildDurationsMean()));
        } else {
            addCell("");
        }
    }
}

From source file:net.bull.javamelody.PdfSessionInformationsReport.java

License:Apache License

private void writeSession(SessionInformations session) throws IOException, BadElementException {
    final PdfPCell defaultCell = getDefaultCell();
    defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    addCell(session.getId());/*from  ww  w. ja va 2s  .c  o  m*/
    defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    addCell(durationFormat.format(session.getLastAccess()));
    addCell(durationFormat.format(session.getAge()));
    addCell(expiryFormat.format(session.getExpirationDate()));
    addCell(integerFormat.format(session.getAttributeCount()));
    defaultCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    if (session.isSerializable()) {
        addCell(getString("oui"));
    } else {
        final Phrase non = new Phrase(getString("non"), severeCellFont);
        addCell(non);
    }
    defaultCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
    addCell(integerFormat.format(session.getSerializedSize()));
    defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
    final String remoteAddr = session.getRemoteAddr();
    if (remoteAddr == null) {
        addCell("");
    } else {
        addCell(remoteAddr);
    }
    defaultCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    writeCountry(session);
    if (displayUser) {
        defaultCell.setHorizontalAlignment(Element.ALIGN_LEFT);
        final String remoteUser = session.getRemoteUser();
        if (remoteUser == null) {
            addCell("");
        } else {
            addCell(remoteUser);
        }
    }
}

From source file:open.dolphin.hiro.PrescriptionPDFMaker.java

private List<PdfPTable> createPrescriptionTbl2() {
    ClaimItem[] items;/*from w w w  . j av  a2  s  .c om*/
    PdfPCell pcell, blank, numCell, amountCell;
    int num, cnt;
    double sum; // @009 ?????(?*)
    List<PdfPTable> preTblList = null;
    String admin, number; // @009
    String classCode, amount, medicine; // @009

    try {
        StringBuilder sb = new StringBuilder();
        sb.append(
                "???????(??)??????????????\n");
        sb.append(
                "?????????????????????????");
        PdfPTable ptbl = new PdfPTable(9); // @009
        ptbl.setWidthPercentage(100f);
        // @009 ???, ?, ??, ?, ??, , "(", , ")"
        float[] widthsP = { 14, 7, 52, 8, 15, 32, 2, 5, 9 };
        ptbl.setWidths(widthsP);
        ptbl.getDefaultCell().setPadding(0f);
        preTblList = new ArrayList<PdfPTable>();

        num = 1;
        //admin = "";  // @009 
        //number = ""; // @009 
        //amount = ""; // @009 ?
        numCell = new PdfPCell(new Paragraph("", min_8)); // @009
        numCell.setBorderWidth(LINE_WIDTH_0); // @009

        PdfPCell notes = new PdfPCell(new Paragraph("??", min_8));
        notes.setBorderWidth(LINE_WIDTH_1);
        notes.setBorderWidthBottom(LINE_WIDTH_0);
        PdfPCell bracket = new PdfPCell(new Paragraph("", min_15));
        bracket.setBorderWidth(LINE_WIDTH_0);
        bracket.setHorizontalAlignment(Element.ALIGN_RIGHT);
        bracket.setPadding(0f);
        PdfPCell notesDetail = new PdfPCell(new Paragraph(sb.toString(), min_6));
        notesDetail.setBorderWidth(LINE_WIDTH_0);
        notesDetail.setColspan(5);
        PdfPCell bracketC = new PdfPCell(new Paragraph("", min_15));
        bracketC.setBorderWidth(LINE_WIDTH_0);
        bracketC.setHorizontalAlignment(Element.ALIGN_LEFT);
        bracketC.setPadding(0f);
        bracketC.setColspan(2);

        for (Iterator<BundleMed> ite = pkg.getPriscriptionList().iterator(); ite.hasNext();) {
            BundleMed prescription = ite.next();
            admin = prescription.getAdmin(); // @009  
            number = prescription.getBundleNumber(); // @009  ????=1 bundeNumber
            classCode = prescription.getClassCode(); // @009   221 etc 

            items = prescription.getClaimItem();
            //minagawa^                
            boolean genericIsOk = true;

            if (items != null) {
                for (ClaimItem i : items) {
                    if (i.getCode().equals("099209903")) {
                        genericIsOk = false;
                        break;
                    }
                }
            }
            genericIsOk = true;
            //minagawa4                

            if (ptbl.getRows().isEmpty()) {
                ptbl.addCell(notes);
                ptbl.addCell(bracket);
                ptbl.addCell(notesDetail);
                ptbl.addCell(bracketC);
            }

            // @001 2009/11/17 ?
            // items?null???????????????
            // ???????????items ? null ??????
            // if???????????(??????????)
            if (items != null) {
                boolean clearFlg = true; // @004 2010/02/26  ?
                // ********** @009  **********
                //sum = 0; // ?????
                Font adminF = min_8; // 
                boolean wrap = true;
                if (admin != null) {
                    if (admin.length() > 17) {
                        // ??17???4??
                        adminF = min_4;
                        wrap = false;
                    } else if (admin.length() > 11) {
                        // ??11???6??
                        adminF = min_6;
                    }
                }
                Font medicineF; // ??
                // ********** @009  **********

                // ??? ClaimItem iterate
                for (cnt = 0; cnt < items.length; cnt++) {
                    //System.out.println("row size:" + ptbl.getRows().size());

                    // ??
                    if (!genericIsOk) {
                        blank = new PdfPCell(new Paragraph("", min_8));
                        blank.setBorderWidth(LINE_WIDTH_0);
                        blank.setBorderWidthRight(LINE_WIDTH_1);
                        ptbl.addCell(blank);
                        genericIsOk = true;

                    } else {
                        blank = new PdfPCell();
                        blank.setBorderWidth(LINE_WIDTH_0);
                        blank.setBorderWidthRight(LINE_WIDTH_1);
                        ptbl.addCell(blank);
                    }

                    if (ptbl.getRows().size() > 13) {
                        // ?13???????????
                        blank = new PdfPCell();
                        blank.setBorderWidth(LINE_WIDTH_0);
                        blank.setColspan(4);
                        ptbl.addCell(blank);
                        pcell = new PdfPCell(new Paragraph("???", min_8));
                        pcell.setBorderWidth(LINE_WIDTH_0);
                        pcell.setColspan(5);
                        ptbl.addCell(pcell);
                        preTblList.add(ptbl);
                        ptbl = new PdfPTable(9);
                        ptbl.setWidthPercentage(100f);
                        ptbl.setWidths(widthsP);
                        ptbl.getDefaultCell().setPadding(0f);
                        // ??
                        ptbl.addCell(notes);
                        ptbl.addCell(bracket);
                        ptbl.addCell(notesDetail);
                        ptbl.addCell(bracketC);
                        blank = new PdfPCell();
                        blank.setBorderWidth(LINE_WIDTH_0);
                        blank.setBorderWidthRight(LINE_WIDTH_1);
                        ptbl.addCell(blank);
                    }

                    if (cnt > 0) {
                        // ?1?????????
                        blank = new PdfPCell();
                        blank.setBorderWidth(LINE_WIDTH_0);
                        ptbl.addCell(blank);
                    } else {
                        // ?1??????
                        numCell = new PdfPCell(new Paragraph(num++ + ")", min_8));
                        numCell.setBorderWidth(LINE_WIDTH_0);
                        setAlignRight(numCell);
                        ptbl.addCell(numCell);
                        // @004 2010/02/26  
                        // ?1?????? false ??
                        if (!ClaimConst.COMMENT_CODE_0.equals(items[cnt].getCode())) {
                            clearFlg = false;
                        }
                        // @004 2010/02/26  
                    }

                    // ********** @009  **********
                    amount = items[cnt].getNumber();
                    //                        System.out.println("??" + items[cnt].getName());
                    //                        System.out.println("?" + amount);
                    //medicine = "";
                    medicine = items[cnt].getName();
                    //                        System.out.println("????" + medicine.length());
                    if (medicine.length() > 19) {
                        // ????19???7??
                        medicineF = min_7;
                    } else {
                        // ????19???8???
                        medicineF = min_8;
                    }
                    // ********** @009  **********

                    if ((ClaimConst.SUBCLASS_CODE_ID.equals(items[cnt].getClassCodeSystem()))
                            && ((String.valueOf(ClaimConst.YAKUZAI).equals(items[cnt].getClassCode()))
                                    || (String.valueOf(ClaimConst.ZAIRYO).equals(items[cnt].getClassCode())))) {

                        pcell = new PdfPCell(new Paragraph(convertNVL(items[cnt].getName()), medicineF)); // ?? ??? ????
                        pcell.setBorderWidth(LINE_WIDTH_0);
                        ptbl.addCell(pcell);
                        amountCell = new PdfPCell(new Paragraph(convertNVL(amount), min_8)); // ?
                        setAlignRight(amountCell);
                        amountCell.setBorderWidth(LINE_WIDTH_0);
                        ptbl.addCell(amountCell);

                        if (!(String.valueOf(ClaimConst.ZAIRYO).equals(items[cnt].getClassCode()))) {
                            // ?????
                            pcell = new PdfPCell(new Paragraph(convertNVL(items[cnt].getUnit()), min_8)); // ??
                            pcell.setBorderWidth(LINE_WIDTH_0);
                            ptbl.addCell(pcell);
                            // ********** @009  **********
                            pcell = new PdfPCell(new Paragraph(admin, adminF)); // 
                            pcell.setBorderWidth(LINE_WIDTH_0);
                            pcell.setNoWrap(wrap);
                            ptbl.addCell(pcell);
                        } else {
                            blank = new PdfPCell();
                            blank.setColspan(2);
                            blank.setBorderWidth(LINE_WIDTH_0);
                            ptbl.addCell(blank);
                        }

                        if (ClaimConst.RECEIPT_CODE_GAIYO.equals(classCode)) {
                            pcell = new PdfPCell(new Paragraph("", min_8));
                            pcell.setBorderWidth(LINE_WIDTH_0);
                            pcell.setColspan(3);
                            ptbl.addCell(pcell);
                            sum = Double.parseDouble(amount) * Double.parseDouble(number);
                            DecimalFormat f = new DecimalFormat("####0.###");
                            //                                System.out.println("??" + sum);
                            amountCell.getPhrase().clear();
                            amountCell.getPhrase().add(new Paragraph(String.valueOf(f.format(sum)), min_8)); // ?
                        } else {
                            // 
                            if ((number != null) && !("".equals(number))) {
                                pcell = new PdfPCell(new Paragraph("(", min_8));
                                pcell.setBorderWidth(LINE_WIDTH_0);
                                ptbl.addCell(pcell);
                                pcell = new PdfPCell(new Paragraph(number, min_8));
                                pcell.setBorderWidth(LINE_WIDTH_0);
                                setAlignRight(pcell);
                                ptbl.addCell(pcell);

                                //minagawa^          
                                if (classCode.startsWith("22")) {
                                    // 
                                    pcell = new PdfPCell(new Paragraph(")", min_8));
                                } else if (classCode.startsWith("21")) {
                                    // 
                                    pcell = new PdfPCell(new Paragraph(")", min_8));
                                    // 
                                } else if (classCode.startsWith("23")) {
                                    pcell = new PdfPCell(new Paragraph("", min_8));
                                }
                                //minagawa$     
                                pcell.setBorderWidth(LINE_WIDTH_0);
                                setAlignRight(pcell);
                                ptbl.addCell(pcell);
                            } else {
                                blank = new PdfPCell();
                                blank.setBorderWidth(LINE_WIDTH_0);
                                blank.setColspan(3);
                                ptbl.addCell(blank);
                            }
                        }
                        // ********** @009  **********
                    } else {
                        pcell = new PdfPCell(new Paragraph(convertNVL(items[cnt].getName()), min_8));
                        pcell.setBorderWidth(LINE_WIDTH_0);
                        pcell.setColspan(7);
                        ptbl.addCell(pcell);
                    }
                }
                // @004 2010/02/26  
                // ?? true ????
                if (clearFlg && (admin == null)) {
                    numCell.getPhrase().clear();
                    num--;
                }
                // @004 2010/02/26  

            } else {
                String stampName = prescription.getOrderName();
                System.err.println("??" + stampName
                        + "????????????");
                StringBuilder b = new StringBuilder();
                b.append("??").append(stampName)
                        .append("?????????").append(System.getProperty(STR_LF));
                System.err.println(b.toString());
            }

            if (!ite.hasNext()) {
                blank = new PdfPCell();
                blank.setBorderWidth(LINE_WIDTH_0);
                ptbl.addCell(blank);
                pcell = new PdfPCell(new Paragraph("", min_8));
                pcell.setBorderWidth(LINE_WIDTH_0);
                pcell.setBorderWidthLeft(LINE_WIDTH_1);
                pcell.setPaddingLeft(30f);
                pcell.setColspan(8);
                ptbl.addCell(pcell);
                preTblList.add(ptbl);
            }
        }
    } catch (Exception e) {
        e.printStackTrace(System.err);
    }
    return preTblList;
}

From source file:open.dolphin.hiro.PrescriptionPDFMaker.java

/**
 * ??
 * ???
 * @param pcell
 */
private void setAlignRight(PdfPCell pcell) {
    pcell.setHorizontalAlignment(Element.ALIGN_RIGHT);
}

From source file:open.dolphin.hiro.PrescriptionPDFMaker.java

/**
 * ??
 * ??
 * @param pcell
 */
private void setAlignLeft(PdfPCell pcell) {
    pcell.setHorizontalAlignment(Element.ALIGN_LEFT);
}

From source file:open.dolphin.hiro.PrescriptionPDFMaker.java

/**
 * ??
 * 
 * @param pcell
 */
private void setAlignCenter(PdfPCell pcell) {
    pcell.setHorizontalAlignment(Element.ALIGN_CENTER);
}

From source file:open.dolphin.hiro.PrescriptionPDFMaker.java

/**
 * ??//from w w  w.j a  va 2s.c  om
 * ?
 * @param pcell
 */
private void setAlignJustifiedAll(PdfPCell pcell) {
    pcell.setHorizontalAlignment(Element.ALIGN_JUSTIFIED_ALL);
}

From source file:optika.sql.java

public void eksportoNePdf(String id) {
    Document document = new Document() {
    };//from   www. ja  va2s .c o  m
    try {
        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("receta.pdf"));
        document.open();
        document.setPageSize(PageSize.A3);

        Image img = Image.getInstance("receta.jpg");
        img.setAbsolutePosition(450f, 10f);

        img.scaleToFit(600, 849);

        img.setAlignment(Image.LEFT | Image.ALIGN_BOTTOM | Image.ALIGN_BASELINE);
        img.setAbsolutePosition(0, 0);
        document.add(img);
        String[][] receta = merrReceten("select * from recetat where id=" + parseInt(id) + ";");
        String[][] tabela = merrReceten("select * from tabela where recetat_id=" + parseInt(id) + ";");
        int[] white = new int[tabela.length];
        for (int i = 0; i < tabela.length; i++) {
            white[i] = 0;
            int bosh = 0;
            for (int j = 3; j < tabela[i].length; j++) {
                if (tabela[i][j] == tabela[i][6]) {
                    continue;
                }

                if (!tabela[i][j].isEmpty()) {
                    bosh = 1;
                }

            }

            if (bosh == 0) {
                white[i] = 1;
            }
        }
        Paragraph data = new Paragraph("Data: " + receta[0][7]);
        data.setSpacingBefore(38);
        data.setSpacingAfter(40);
        PdfPTable table = new PdfPTable(7);
        if (white[0] == 0) {
            table.addCell(getCellPadding("" + tabela[0][3], 1));
        } else {
            table.addCell(getCellWhite("_", 1, 30));
        }
        table.addCell(getCellPadding("" + tabela[0][4], 1));
        table.addCell(getCellPadding("" + tabela[0][5], 1));
        table.addCell(getCellPadding("", 1));
        table.addCell(getCellPadding("" + tabela[0][7], 1));
        table.addCell(getCellPadding("" + tabela[0][8], 1));
        table.addCell(getCellPadding("" + tabela[0][9], 1));
        table.setWidthPercentage(105);
        table.setHorizontalAlignment(-100);

        if (white[1] == 0) {
            table.addCell(getCellPadding("" + tabela[1][3], 1));
        } else {

            table.addCell(getCellWhite("_", 1, 36));
        }
        table.addCell(getCellPadding("" + tabela[1][4], 1));
        table.addCell(getCellPadding("" + tabela[1][5], 1));
        table.addCell(getCellPadding("", 1));
        table.addCell(getCellPadding("" + tabela[1][7], 1));
        table.addCell(getCellPadding("" + tabela[1][8], 1));
        table.addCell(getCellPadding("" + tabela[1][9], 1));
        table.setWidthPercentage(105);
        table.setHorizontalAlignment(-100);

        if (white[2] == 0) {
            if (white[1] == 0) {
                table.addCell(getCell("" + tabela[2][3], 1, 30));

            } else {
                table.addCell(getCellWhite("_", 1, 23));
            }
        } else {

            table.addCell(getCellWhite("_", 1, 28));

        }
        table.addCell(getCell("" + tabela[2][4], 1, 0));
        table.addCell(getCell("" + tabela[2][5], 1, 0));
        table.addCell(getCell("", 1, 0));
        table.addCell(getCell("" + tabela[2][7], 1, 0));
        table.addCell(getCell("" + tabela[2][8], 1, 0));
        table.addCell(getCell("" + tabela[2][9], 1, 0));
        table.setWidthPercentage(105);
        table.setSpacingBefore(27);
        table.setHorizontalAlignment(-100);

        String[][] distanca = merrReceten("select * from distanca where recetat_id=" + parseInt(id) + ";");

        PdfPTable largAfer = new PdfPTable(3);

        if (distanca[0][3].isEmpty()) {
            PdfPCell larg = getCellWhite("_", 2, 15);
            largAfer.addCell(larg);
        } else {
            PdfPCell larg = new PdfPCell(new Phrase("" + distanca[0][3]));
            larg.setPadding(0);
            larg.setHorizontalAlignment(2);
            larg.setBorder(PdfPCell.NO_BORDER);
            larg.setPaddingBottom(20);
            largAfer.addCell(larg);
        }
        largAfer.addCell(getCell("", PdfPCell.ALIGN_RIGHT, 25));

        if (distanca[0][8].isEmpty()) {
            largAfer.addCell(getCellWhite("_", PdfPCell.ALIGN_RIGHT, 15));
        } else {
            largAfer.addCell(getCell("" + distanca[0][8], PdfPCell.ALIGN_RIGHT, 25));
        }
        largAfer.setWidthPercentage(75);
        largAfer.setHorizontalAlignment(350);

        PdfPTable od_os = new PdfPTable(5);
        od_os.addCell(getCell("OD= " + distanca[0][4], 0, 195));
        od_os.addCell(getCell("OS= " + distanca[0][5], 2, 195));
        od_os.addCell(getCell("", 0, 0));
        od_os.addCell(getCell("OD= " + distanca[0][9], 0, 0));
        od_os.addCell(getCell("OS= " + distanca[0][10], 1, 0));
        od_os.setWidthPercentage(90);
        od_os.setHorizontalAlignment(150);

        PdfPTable visusi = new PdfPTable(2);
        if (distanca[0][6].isEmpty()) {
            PdfPCell od_pa = getCellWhite("_", 2, 17);
            od_pa.setPaddingRight(45);
            visusi.addCell(od_pa);
        } else {
            PdfPCell od_pa = getCell(distanca[0][6], 2, 17);
            od_pa.setPaddingRight(45);
            visusi.addCell(od_pa);
        }

        if (distanca[0][11].isEmpty()) {
            visusi.addCell(getCellWhite("_", 2, 17));
        } else {
            visusi.addCell(getCell(distanca[0][11], 2, 17));
        }

        if (distanca[0][7].isEmpty()) {
            PdfPCell os_pa = getCellWhite("_", 2, 17);
            os_pa.setPaddingRight(45);
            visusi.addCell(os_pa);
        } else {
            PdfPCell os_pa = getCell(distanca[0][7], 2, 17);
            os_pa.setPaddingRight(45);
            visusi.addCell(os_pa);
        }

        if (distanca[0][12].isEmpty()) {
            visusi.addCell(getCellWhite("_", 2, 17));
        } else {
            visusi.addCell(getCell(distanca[0][12], 2, 0));
        }
        visusi.setWidthPercentage(100);
        visusi.setHorizontalAlignment(50);

        String[][] admin = merrReceten("select * from admin where id=1;");
        PdfPTable klienti = new PdfPTable(3);
        klienti.addCell(getCell("", 0, 0));
        klienti.addCell(getCell("", 0, 0));
        klienti.addCell(getCell("Emri: " + receta[0][2], 0, 0));

        klienti.addCell(getCell("Celular: " + admin[0][4], 0, 0));
        klienti.addCell(getCell("", 0, 0));
        PdfPCell celReceta = getCell("Celular: " + receta[0][4], 0, 0);
        celReceta.setPaddingTop(5);
        klienti.addCell(celReceta);

        klienti.addCell(getCell("Email: " + admin[0][5], 0, 0));
        klienti.addCell(getCell("", 0, 0));
        PdfPCell emailReceta = getCell("Email: " + receta[0][5], 0, 0);
        emailReceta.setPaddingBottom(5);
        emailReceta.setPaddingTop(5);
        klienti.addCell(emailReceta);

        klienti.addCell(getCell("Adresa: " + admin[0][6], 0, 0));
        klienti.addCell(getCell("", 0, 0));
        klienti.addCell(getCell("Adresa: " + receta[0][6], 0, 0));
        klienti.setSpacingBefore(50);

        PdfPTable kreu = new PdfPTable(1);
        kreu.addCell(getCell(" ", 0, 0));

        document.add(kreu);
        document.add(klienti);
        document.add(data);
        document.add(table);
        document.add(largAfer);
        document.add(od_os);
        document.add(visusi);

    } catch (DocumentException de) {
        System.err.println(de.getMessage());
    } catch (IOException ioe) {
        System.err.println(ioe.getMessage());
    }
    document.close();

}