Example usage for com.itextpdf.text Element ALIGN_LEFT

List of usage examples for com.itextpdf.text Element ALIGN_LEFT

Introduction

In this page you can find the example usage for com.itextpdf.text Element ALIGN_LEFT.

Prototype

int ALIGN_LEFT

To view the source code for com.itextpdf.text Element ALIGN_LEFT.

Click Source Link

Document

A possible value for paragraph alignment.

Usage

From source file:edu.cornell.mannlib.vitro.webapp.visualization.visutils.PDFDocument.java

License:Open Source License

private void createImage(Document document, PdfWriter writer, Font featureHeaderStyle)
        throws BadElementException, MalformedURLException, IOException, DocumentException {
    Image imageSprite = Image.getInstance(new URL(
            "http://lh3.ggpht.com/_4msVPAgKJv8/SCRYD-pPVKI/AAAAAAAAAYU/zUN963EPoZc/s1024/102_0609.JPG"));
    imageSprite.setAbsolutePosition(400, 500);
    imageSprite.scaleAbsolute(171.0f, 250.0f);
    float imageSpriteY = document.getPageSize().getHeight() * 0.60f;
    float imageSpriteX = document.getPageSize().getWidth() * 0.65f;
    imageSprite.setAlignment(Image.UNDERLYING);

    document.add(imageSprite);//ww w  .  jav  a2s . c om

    PdfContentByte cb = writer.getDirectContent();
    ColumnText ct = new ColumnText(cb);
    Chunk imageHeader = new Chunk("Images", featureHeaderStyle);
    ct.addText(imageHeader);
    ct.setAlignment(Element.ALIGN_LEFT);
    ct.setSimpleColumn(imageSpriteX, imageSpriteY - imageSprite.getScaledHeight(),
            imageSpriteX + imageSprite.getScaledWidth(), imageSpriteY + imageSprite.getScaledHeight() + 20);
    ct.go();

    ct = new ColumnText(cb);
    Chunk imageFooter = new Chunk("Footer to be set for a figure. Similar to 'image cpation'.",
            FontFactory.getFont(FontFactory.TIMES_ROMAN, 8));
    ct.addText(imageFooter);
    ct.setAlignment(Element.ALIGN_CENTER);
    ct.setSimpleColumn(imageSpriteX, imageSpriteY - 150, imageSpriteX + imageSprite.getScaledWidth(),
            imageSpriteY);
    ct.go();
}

From source file:edu.cornell.mannlib.vitro.webapp.visualization.visutils.PDFDocument.java

License:Open Source License

private PdfPTable createTable(Map<String, Integer> yearToPublicationCount) {

    Font normalContentStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 11);
    Font summaryContentStyle = FontFactory.getFont(FontFactory.TIMES_ROMAN, 11, Font.BOLDITALIC);
    BaseColor summaryBackgroundColor = new BaseColor(0xEE, 0xEE, 0xEE);
    BaseColor headerBackgroundColor = new BaseColor(0xC3, 0xD9, 0xFF);
    BaseColor bodyBackgroundColor = new BaseColor(Color.white);

    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(36.0f);/*  w  ww  . j a  v  a 2 s . c o  m*/

    table.setHorizontalAlignment(Element.ALIGN_LEFT);
    table.getDefaultCell().setBorderWidth(0.0f);
    table.setHeaderRows(2);

    PdfPCell cell;
    cell = new PdfPCell(new Phrase("Publications per year", normalContentStyle));
    setTableCaptionStyle(summaryBackgroundColor, cell);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("Year", normalContentStyle));
    setTableHeaderStyle(headerBackgroundColor, cell);
    table.addCell(cell);

    cell.setPhrase(new Phrase("Publications", normalContentStyle));
    table.addCell(cell);

    setTableBodyStyle(bodyBackgroundColor, cell);
    int totalPublications = 0;

    for (Entry<String, Integer> currentEntry : yearToPublicationCount.entrySet()) {

        cell.setPhrase(new Phrase(currentEntry.getKey(), normalContentStyle));
        table.addCell(cell);

        cell.setPhrase(new Phrase(currentEntry.getValue().toString(), normalContentStyle));
        table.addCell(cell);

        totalPublications += currentEntry.getValue();
    }

    setTableFooterStyle(summaryBackgroundColor, cell);
    cell.setPhrase(new Phrase("Total", summaryContentStyle));
    table.addCell(cell);

    cell.setPhrase(new Phrase(String.valueOf(totalPublications), summaryContentStyle));
    table.addCell(cell);

    return table;
}

From source file:EplanPrinter.PDFPrint.java

License:Open Source License

public String insertComment(String sx, String sy, String id, String deptValue, String userInit, String comment,
        int pageNum, int masterHeight, int masterWidth, int pinned, int customFontSize)
        throws DocumentException, IOException {
    float ratio = getRatio(masterHeight, masterWidth, pageNum);
    float x = Float.parseFloat(sx);
    float y = Float.parseFloat(sy);
    float[] f = commentTrans(x, y, masterHeight, masterWidth, pageNum);
    PdfGState gs1 = new PdfGState();
    gs1.setFillOpacity(1);/*  w  w w  .  java  2s  .c  o  m*/
    if (customFontSize > 0)
        fontSize = customFontSize;

    PdfContentByte fg = pds.getOverContent(pageNum);
    fg.setGState(gs1);
    BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
    float[] trans = translate(x, y, r[pageNum - 1].getHeight(), r[pageNum - 1].getWidth(), masterHeight,
            masterWidth, pageNum);
    // comment tag image (width=35pts, height=8pts)
    float[] scalar = scale(trans[0], trans[1], 35, 8, masterHeight, masterWidth, pageNum);

    /* Addition. ftorres - 7/21/2015 - Added to account for rotated pages 
     *   with the origin (0,0) not set to the bottom-left of the page. [1400] */
    float coords[] = translateRotation(trans[0], trans[1], pageNum);
    coords = checkBounds(coords[0], coords[1], pageNum);

    /* Addition. ftorres - 10/20/2015 - If the comment was pinned in EPC, then
     *   render the comment inside a comment box. */
    if (pinned == 1) {
        insertPinnedComment(coords[0], coords[1], id + " - " + deptValue + " (" + userInit + ")", comment,
                pageNum, masterHeight, masterWidth);

        // Add the pinned comment text to page annotation -Jon Changkachith 11/24/2015
        Rectangle rect = new Rectangle(0, 0, 0, 0);
        PdfAnnotation annotation = PdfAnnotation.createText(pds.getWriter(), rect,
                id + " - " + deptValue + " (" + userInit + ")", cleanupComment(comment), true, id);
        pds.addAnnotation(annotation, pds.getWriter().getCurrentPageNumber());
    } else {
        Image image = Image.getInstance(commentIMGPath);
        image.setAbsolutePosition(coords[0] + (scalar[0] * (id.length() / 5f)), coords[1]);

        /*
         * Commented out by Jon Changkachith 12/09/2015 because it was throwing
         * DocumentException with the message "The image must have absolute positioning."
        image.scaleAbsoluteHeight(1);
        image.scaleAbsoluteWidth(1);
        */
        image.scalePercent(ratio); //Added to fix DocumentException "The image must have absolute positioning." Jon Changkachith 12/09/2015
        image.setAnnotation(new Annotation(id + " - " + deptValue + " (" + userInit + ")",
                cleanupComment(comment), 0, 0, 0, 0));
        fg.addImage(image);
    }

    fg.setLineWidth(.5f * ratio);
    fg.setColorStroke(new BaseColor(Color.decode("0x6E2405").getRGB()));
    fg.setColorFill(new BaseColor(Color.decode("0x6E2405").getRGB()));

    float tHeight = scalar[1];
    float tWidth = 0;
    if (id.length() > 3) {
        tWidth = (scalar[0] * (id.length() / 5f));
    } else {
        tWidth = (scalar[0]);
    }

    fg.moveTo(coords[0], coords[1]);
    fg.lineTo(coords[0] + (10f * ratio), coords[1] - (tHeight / 2));
    fg.lineTo(coords[0] + tWidth, coords[1] - (tHeight / 2));
    fg.lineTo(coords[0] + tWidth, coords[1] + (tHeight / 2));
    fg.lineTo(coords[0] + (10f * ratio), coords[1] + (tHeight / 2));

    fg.lineTo(coords[0], coords[1]);
    fg.closePathFillStroke();
    fg.fill();

    // Comment number that goes on the comment tag image
    Phrase p = new Phrase(id);
    p.getFont().setColor(BaseColor.WHITE);
    p.getFont().setSize(8f * ratio); //comment number font size = 8f
    //p.getChunks().get(0).setAnnotation(PdfAnnotation.createText(pds.getWriter(), new Rectangle(trans[0],trans[1], trans[0]+5f, trans[1]+5f), id, comment, true, id));

    float fs[] = translateRotation(f[0], f[1], pageNum);
    fs = checkBounds(fs[0], fs[1], pageNum);
    ColumnText.showTextAligned(fg, Element.ALIGN_LEFT, p, (float) (fs[0] + (9 * ratio)),
            (float) (fs[1] - (3 * ratio)), 0);

    return "";
}

From source file:EplanPrinter.PDFPrint.java

License:Open Source License

private void insertPinnedComment(float xCoord, float yCoord, String id, String comment, int pageNum,
        int masterHeight, int masterWidth) throws DocumentException, IOException {

    int standardHeight = 38;
    int standardWidth = 130;
    int lineHeight = 7;

    if (fontSize == 8) {
        standardHeight = 48;/* w  w w  .ja v  a 2  s . c o  m*/
        standardWidth = 180;
        lineHeight = 10;
    } else if (fontSize == 10) {
        standardHeight = 70;
        standardWidth = 210;
        lineHeight = 12;
    }

    // comment box position defines lower-left corner
    xCoord += 41; // x-coordinate of comment text box
    yCoord -= 7; // lower offset moves box up

    float f = (float) 0.4;
    PdfGState gs1 = new PdfGState();
    gs1.setFillOpacity(f);

    PdfContentByte fg = pds.getOverContent(pageNum);
    fg.setGState(gs1);
    fg.setLineWidth(.5f * getRatio(masterHeight, masterWidth, pageNum));

    // Calculate additional needed height for the comment, based on length of comment.
    List<String> lines = createComment(cleanupComment(comment));
    int numLines = lines.size();
    int commentHeight = (numLines - 1) * lineHeight;

    // Draw the comment box
    String color = "0xF2F3E4";
    Color c = Color.decode(color);
    color = "0xFAFAF4";
    Color c2 = Color.decode(color);
    fg.setLineWidth(1f);
    fg.setColorStroke(new BaseColor(c.getRGB()));
    fg.setColorFill(new BaseColor(c2.getRGB()));
    float newCoords[] = pinnedCoords(xCoord, yCoord, standardWidth, standardHeight + commentHeight);
    fg.roundRectangle(xCoord, newCoords[1], standardWidth, standardHeight + commentHeight, 2f);
    fg.fillStroke();

    //BaseFont bf = BaseFont.createFont();
    BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, true);
    BaseFont bfb = BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, true);
    fg.setColorFill(BaseColor.RED);
    gs1.setFillOpacity(0.8f);
    fg.setGState(gs1);

    // Adding comment title text
    Phrase phrase = new Phrase("Comment", new Font(bfb, fontSize));
    ColumnText.showTextAligned(fg, Element.ALIGN_LEFT, phrase, xCoord + 3, yCoord - 7, 0);

    // Adding comment number
    phrase = new Phrase(id, new Font(bf, fontSize));
    float offset = xCoord + 35;
    if (fontSize == 8)
        offset = xCoord + 45;
    else if (fontSize == 10)
        offset = xCoord + 55;
    ColumnText.showTextAligned(fg, Element.ALIGN_LEFT, phrase, offset, yCoord - 7, 0);

    /*  Remove 10/27/2015 Jon Changkachith
    // Adding 'comment' label text
    phrase = new Phrase("Comment", new Font(bfb, fontSize));
    ColumnText.showTextAligned(fg, Element.ALIGN_LEFT, phrase, xCoord + 3, yCoord - 20f, 0);
    */

    // Adding comment text
    int commentYOffset = 32;
    for (int i = 0; i < lines.size(); i++) {
        //phrase = new Phrase(lines.get(i), new Font(bf, fontSize));
        phrase = composePhrase(lines.get(i), bf, bfb);
        ColumnText.showTextAligned(fg, Element.ALIGN_LEFT, phrase, xCoord + 3, yCoord - commentYOffset, 0);
        commentYOffset += lineHeight;
    }

}

From source file:es.clinica.veterinaria.albaranes.AlbaranPdf.java

private void addTitlePage(Document document) throws DocumentException {
    Paragraph preface = new Paragraph();
    // We add one empty line
    addEmptyLine(preface, 1);/*  ww  w  . j  a v a 2 s .  c  om*/
    // Lets write a big header
    String fecha = new SimpleDateFormat("dd / MM / yyyy").format(venta.getFecha());
    preface.add(new Paragraph("ALBAR?N N " + venta.getId()
            + "                                                            " + fecha, catFont));

    addEmptyLine(preface, 2);
    document.add(preface);
    // Will create: Report generated by: _name, _date
    //preface.add(new Paragraph("Report generated by: " + System.getProperty("user.name") + ", " + new Date(), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    //    smallBold));
    //addEmptyLine(preface, 3);
    //preface.add(new Paragraph("This document describes something which is very important ", smallBold));
    preface = new Paragraph("SERVICIOS MDICOS-VETERINARIOS");
    preface.setAlignment(Element.ALIGN_CENTER);
    addEmptyLine(preface, 2);
    document.add(preface);

    preface = new Paragraph("Cliente: " + venta.getCliente().getFullname() + "\nTelfono: "
            + venta.getCliente().getTelefono());
    preface.setAlignment(Element.ALIGN_LEFT);
    addEmptyLine(preface, 2);
    document.add(preface);
    //preface.add(new Paragraph("This document is a preliminary version and not subject to your license agreement or any other agreement with vogella.com ;-).",
    //    redFont));

    //document.add(preface);
    // Start a new page
    // document.newPage();
}

From source file:es.sm2.openppm.front.utils.DocumentUtils.java

License:Open Source License

/**
 * //from  w w w .  j  a va  2 s  .c om
 * @param content
 * @param font
 * @param borderTop
 * @param borderRight
 * @param borderBottom
 * @param borderLeft
 * @return
 */
private static PdfPCell prepareHeaderCell(String content, Font font, Float borderTop, Float borderRight,
        Float borderBottom, Float borderLeft) {
    PdfPCell cell = new PdfPCell(new Paragraph(content, font));
    cell.setBorderWidthTop(borderTop);
    cell.setBorderWidthRight(borderRight);
    cell.setBorderWidthBottom(borderBottom);
    cell.setBorderWidthLeft(borderLeft);
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setPaddingLeft(5F);

    return cell;
}

From source file:es.sm2.openppm.front.utils.DocumentUtils.java

License:Open Source License

/**
 * /*  ww  w  . j a v  a 2 s .c o  m*/
 * @param content
 * @param font
 * @param borderTop
 * @param borderRight
 * @param borderBottom
 * @param borderLeft
 * @return
 */
private static PdfPCell prepareCell(String content, Font font, Float borderTop, Float borderRight,
        Float borderBottom, Float borderLeft) {
    PdfPCell cell = new PdfPCell(new Paragraph(content, font));
    cell.setBorderWidthTop(borderTop);
    cell.setBorderWidthRight(borderRight);
    cell.setBorderWidthBottom(borderBottom);
    cell.setBorderWidthLeft(borderLeft);
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
    cell.setPaddingBottom(3F);
    cell.setPaddingLeft(5F);

    return cell;
}

From source file:es.sm2.openppm.front.utils.DocumentUtils.java

License:Open Source License

/**
 * // w w  w .j  a  v  a 2 s  .c o m
 * @param content
 * @param font
 * @return
 */
private static PdfPCell prepareSubCell(String content, Font font) {
    PdfPCell cell = new PdfPCell(new Paragraph(content, font));
    cell.setBorderWidth(0F);
    cell.setHorizontalAlignment(Element.ALIGN_LEFT);

    return cell;
}

From source file:Export.ExporOnlyViagemPdf.java

private PdfPTable cellRodape(String value, boolean l, boolean r, int align) {
    Font fontCorpoTableO = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 7.5f);
    PdfPTable pTable = new PdfPTable(1);
    pTable.setWidthPercentage(100f);//w  w w.  j  av a 2  s  .c o  m
    PdfPCell cellValue = new PdfPCell(new Phrase(value, fontCorpoTableO));
    if (l) {
        cellValue.setBorderWidthLeft(0);
    }
    if (r) {
        cellValue.setBorderWidthRight(0);
    }
    switch (align) {
    case Element.ALIGN_RIGHT:
        cellValue.setHorizontalAlignment(Element.ALIGN_RIGHT);
        break;
    case Element.ALIGN_LEFT:
        cellValue.setHorizontalAlignment(Element.ALIGN_LEFT);
        break;
    case Element.ALIGN_CENTER:
        cellValue.setHorizontalAlignment(Element.ALIGN_CENTER);
        break;
    default:
        break;
    }
    pTable.addCell(cellValue);
    return pTable;
}

From source file:Export.ExportMapaProducao__.java

public String criarDoc(String user, Date dataInicio, Date dataFim) {
    try {//w  w w.  ja v a 2s.  com
        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy hh'.'mm'.'ss");
        SimpleDateFormat sdfPT = new SimpleDateFormat("dd-MM-yyyy");

        Font fontCabecalhoN = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 10f);
        Font fontCorpo = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 9f);
        Font fontCorpoTable = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f);
        Font fontCorpoBP = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f);
        Font fontCorpoN = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 8.5f);
        Font fontCorpoNG = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 9.5f);
        Font fontCabecalhoNG = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 16f,
                Font.UNDERLINE);

        Document documento = new Document();
        documento.setPageSize(PageSize.A4.rotate());
        documento.setMargins(10f, 10f, 35f, 80f);

        File ff = new File(getDiretorio() + "/" + user + "/Relatorio/");
        ff.mkdirs();

        String stringData = sdf.format(new Date());

        ff = new File(ff.getAbsoluteFile() + "/" + "Export Mapa Producao " + stringData + ".pdf");

        String reString = "../Documentos/" + user + "/Relatorio/" + "Export Mapa Producao " + stringData
                + ".pdf";

        OutputStream outputStraem = new FileOutputStream(ff);
        PdfWriter writer = PdfWriter.getInstance(documento, outputStraem);

        MyFooter event = new MyFooter();
        writer.setPageEvent(event);
        documento.open();

        PdfPTable pTableEmpresaPricipal = new PdfPTable(new float[] { 10f, 90f });
        PdfPTable pTableEmpresaInforImpres1 = new PdfPTable(1);
        PdfPTable pTableEmpresaInforImpres5 = new PdfPTable(1);

        PdfPTable pTableNull = new PdfPTable(1);
        PdfPCell cellNull = new PdfPCell(new Phrase(" ", fontCorpo));
        cellNull.setBorder(0);
        pTableNull.addCell(cellNull);

        PdfPCell pCellNomeEmpresa = new PdfPCell(new Phrase(Empresa.NOME, fontCabecalhoNG));
        pCellNomeEmpresa.setBorder(0);

        PdfPCell pCellNomeEndereco = new PdfPCell(new Phrase(Empresa.ENDERECO, fontCabecalhoN));
        pCellNomeEndereco.setBorder(0);

        PdfPCell pCellCaixaPostal = new PdfPCell(new Phrase(Empresa.CAIXAPOSTAL, fontCabecalhoN));
        pCellCaixaPostal.setBorder(0);

        PdfPCell pCellTeleFax = new PdfPCell(
                new Phrase(Empresa.TELEFAX + " " + ConfigDoc.Empresa.EMAIL, fontCabecalhoN));
        pCellTeleFax.setBorder(0);

        PdfPCell pCellSociedade = new PdfPCell(new Phrase(Empresa.SOCIEDADE, fontCabecalhoN));
        pCellSociedade.setBorder(0);

        Image imageEmpresa = Image.getInstance("logo.png");
        imageEmpresa.scaleToFit(120f, 85f);

        pTableEmpresaInforImpres1.addCell(pCellNomeEmpresa);
        pTableEmpresaInforImpres1.addCell(pCellNomeEndereco);
        pTableEmpresaInforImpres1.addCell(pCellCaixaPostal);
        pTableEmpresaInforImpres1.addCell(pCellTeleFax);
        pTableEmpresaInforImpres1.addCell(pCellSociedade);

        PdfPCell cellTabela3 = new PdfPCell(pTableEmpresaInforImpres1);
        cellTabela3.setBorder(0);

        pTableEmpresaInforImpres5.addCell(cellTabela3);

        PdfPCell cellTabela5 = new PdfPCell(pTableEmpresaInforImpres5);
        cellTabela5.setBorder(0);

        PdfPCell cellTabela6 = new PdfPCell(imageEmpresa);
        cellTabela6.setBorder(0);
        pTableEmpresaPricipal.setWidthPercentage(95);
        pTableEmpresaPricipal.addCell(cellTabela6);
        pTableEmpresaPricipal.addCell(cellTabela5);

        documento.add(pTableEmpresaPricipal);
        documento.add(pTableNull);

        PdfPTable pptTitileMapa = new PdfPTable(new float[] { 100 });
        pptTitileMapa.setWidthPercentage(95);
        PdfPCell cellTitileMapa = new PdfPCell(new Phrase("Mapa de produo de ".toUpperCase()
                + ((dataInicio != null) ? sdfPT.format(dataInicio) + "  "
                        : " dos Ultimos anos te hoje".toUpperCase())
                + ((dataFim == null) ? "" : sdfPT.format(dataFim)), fontCorpoNG));
        cellTitileMapa.setBorder(0);
        cellTitileMapa.setHorizontalAlignment(Element.ALIGN_CENTER);
        pptTitileMapa.addCell(cellTitileMapa);
        documento.add(pptTitileMapa);
        documento.add(pTableNull);

        ResultSet rs = ud.relatorioSeguroForImpresao(dataInicio, dataFim);
        Consumer<HashMap<String, Object>> act = (map) -> {
            list = new ArrayList<>();
            putNewDado(map, dataInicio, dataFim);
        };
        Call.forEchaResultSet(act, rs);

        int f = 0;
        for (Map.Entry<String, ArrayList<Producao>> al : hasList.entrySet()) {
            if (f > 0) {
                documento.add(pTableNull);
                documento.add(pTableNull);
            }
            f++;
            PdfPTable pptTitulo = new PdfPTable(new float[] { 100 });
            pptTitulo.setWidthPercentage(95);

            PdfPCell cellTitulo = new PdfPCell(new Phrase(al.getKey().toUpperCase(), fontCorpoNG));
            cellTitulo.setBorder(0);
            pptTitulo.addCell(cellTitulo);

            documento.add(pptTitulo);
            documento.add(pTableNull);

            PdfPTable pTableDate = HeadTablePrincipal();
            documento.add(pTableDate);

            for (Producao pro : al.getValue()) {
                pTableDate = new PdfPTable(new float[] { 9.7f, 28.8f, 14.7f, 10.7f, 10.7f, 10.7f, 14.7f });
                pTableDate.setWidthPercentage(95);
                if (!pro.DATA.equals("SOMATORIO")) {
                    newDado(pro.NUMAPOLICE, fontCorpoTable, pTableDate, documento, Element.ALIGN_LEFT, 0.5f);
                    newDado(pro.CLIENTESEGURO, fontCorpoTable, pTableDate, documento, Element.ALIGN_LEFT, 0.5f);
                    priencherTable(pro, fontCorpoTable, pTableDate, documento, 0.5f);
                } else {
                    PdfPTable pTableDate2 = rodapeTabelaPrincipal();
                    newDado(("TOTAL " + al.getKey()).toUpperCase(), fontCorpoN, pTableDate2, documento,
                            Element.ALIGN_LEFT, 1.5f);
                    priencherTable(pro, fontCorpoBP, pTableDate2, documento, 1.5f);
                }
            }
        }

        PdfPTable pTableAssinatura = new PdfPTable(new float[] { 50f, 50f });
        pTableAssinatura.setTotalWidth(700f);

        PdfPCell cellAssinatura = new PdfPCell();
        cellAssinatura.setBorder(0);
        Paragraph assinatora = new Paragraph("DIRETOR TECNICO", fontCorpoN);
        assinatora.setAlignment(Element.ALIGN_CENTER);
        Paragraph espaco = new Paragraph(" ", fontCorpoN);
        Paragraph linha = new Paragraph("______________________________________", fontCorpoN);
        linha.setAlignment(Element.ALIGN_CENTER);

        cellAssinatura.addElement(assinatora);
        cellAssinatura.addElement(espaco);
        cellAssinatura.addElement(linha);

        pTableAssinatura.addCell(cellAssinatura);

        cellAssinatura = new PdfPCell();
        cellAssinatura.setBorder(0);
        assinatora = new Paragraph("DIRETORA GERAL", fontCorpoN);
        assinatora.setAlignment(Element.ALIGN_CENTER);
        linha.setAlignment(Element.ALIGN_CENTER);

        cellAssinatura.addElement(assinatora);
        cellAssinatura.addElement(espaco);
        cellAssinatura.addElement(linha);

        pTableAssinatura.addCell(cellAssinatura);

        pTableAssinatura.writeSelectedRows(-1, 2, 70, 80, writer.getDirectContent());
        documento.close();

        //           PrintPdf printPdf = new PrintPdf(ff.getAbsolutePath(), ff.getAbsolutePath(), 0, 595f,842f,"Enviar Para o OneNote 2013",0); 
        //PrintPdf printPdf = new PrintPdf(ff.getAbsolutePath(), ff.getAbsolutePath(), 0, 595f,842f,"Hewlett-Packard HP LaserJet P2035",0); 
        //            printPdf.print();
        return reString;
    } catch (BadElementException | IOException ex) {
        Logger.getLogger(SeguroAPG.class.getName()).log(Level.SEVERE, null, ex);
    } catch (DocumentException ex) {
        Logger.getLogger(SeguroAPG.class.getName()).log(Level.SEVERE, null, ex);
    }
    return null;
}