Example usage for com.itextpdf.text Chunk Chunk

List of usage examples for com.itextpdf.text Chunk Chunk

Introduction

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

Prototype

public Chunk(final Image image, final float offsetX, final float offsetY, final boolean changeLeading) 

Source Link

Document

Constructs a chunk containing an Image.

Usage

From source file:be.kcbj.placemat.Placemat.java

License:Open Source License

private PdfPCell generateCell(Sponsor sponsor, float cellHeight) throws IOException, BadElementException {
    int numLines = 0;
    Paragraph p = new Paragraph();

    if (sponsor.image != null) {
        Image image = Image.getInstance(SponsorManager.getImageUrl(sponsor.image));
        if (sponsor.imageWidth != 0) {
            image.scaleToFit(sponsor.imageWidth, 1000);
        } else if (sponsor.imageHeight != 0) {
            image.scaleToFit(1000, sponsor.imageHeight);
        }//from  w w w. j a  v  a  2  s  .  com
        Chunk imageChunk = new Chunk(image, 0, 0, true);
        p.add(imageChunk);
    }

    if (sponsor.twoColumns) {
        StringBuilder sb = new StringBuilder();
        if (sponsor.name != null) {
            sb.append(sponsor.name);
        }
        if (sponsor.name2 != null) {
            if (sb.length() > 0) {
                sb.append(" - ");
            }
            sb.append(sponsor.name2);
        }
        if (sponsor.address != null) {
            if (sb.length() > 0) {
                sb.append(" - ");
            }
            sb.append(sponsor.address);
        }
        if (sponsor.address2 != null) {
            if (sb.length() > 0) {
                sb.append(" - ");
            }
            sb.append(sponsor.address2);
        }
        p.add(Chunk.NEWLINE);
        p.add(new Chunk(sb.toString(), new Font(Font.FontFamily.HELVETICA, 8, Font.NORMAL)));
        numLines++;
    } else {
        if (sponsor.twoRows && sponsor.image != null) {
            p.add(Chunk.NEWLINE);
        }
        if (sponsor.name != null) {
            p.add(generateFittedChunk(sponsor.name, Font.BOLD));
            numLines++;
        }
        if (sponsor.name2 != null) {
            p.add(Chunk.NEWLINE);
            p.add(generateFittedChunk(sponsor.name2, Font.BOLD));
            numLines++;
        }
        if (sponsor.address != null) {
            p.add(new Chunk("\n\n", new Font(Font.FontFamily.HELVETICA, 2, Font.NORMAL)));
            p.add(new Chunk(sponsor.address, new Font(Font.FontFamily.HELVETICA, 7, Font.NORMAL)));
            numLines++;
        }
        if (sponsor.address2 != null) {
            p.add(Chunk.NEWLINE);
            p.add(new Chunk(sponsor.address2, new Font(Font.FontFamily.HELVETICA, 7, Font.NORMAL)));
            numLines++;
        }
    }
    p.setPaddingTop(0);
    p.setSpacingBefore(0);
    p.setAlignment(Element.ALIGN_CENTER);
    p.setMultipliedLeading(numLines <= 3 ? 1.3f : 1.1f);

    PdfPCell cell = new PdfPCell();
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setFixedHeight(cellHeight);
    if (sponsor.twoColumns) {
        cell.setColspan(2);
    }
    if (sponsor.twoRows) {
        cell.setRowspan(2);
        if (sponsor.image == null) {
            p.setMultipliedLeading(p.getMultipliedLeading() * 1.5f);
        }
    }
    cell.setBorder(PdfPCell.NO_BORDER);
    cell.setCellEvent(CELL_EVENT);
    cell.setPaddingBottom(4);
    cell.addElement(p);
    if (sponsor.isTodo()) {
        cell.setBackgroundColor(BaseColor.ORANGE);
    }

    return cell;
}

From source file:com.jpsycn.print.util.PDFUtils.java

private static void stmp(Context mContext, Document document, int x, int y)
        throws MalformedURLException, IOException, DocumentException {

    Resources resources = mContext.getResources();
    int identifier = resources.getIdentifier("stamp", "drawable", mContext.getPackageName());
    Bitmap bitmap = BitmapFactory.decodeResource(resources, identifier);

    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
    Image image = Image.getInstance(stream.toByteArray());

    Chunk c1 = new Chunk(image, x, y, false);
    Paragraph pp = new Paragraph();
    pp.add(c1);// ww w.  j a v a2 s . c  o m
    document.add(pp);
}

From source file:com.jpsycn.print.util.PDFUtils.java

private static void zxing(String zxing, Context mContext, Document document)
        throws MalformedURLException, IOException, DocumentException {

    if (!TextUtils.isEmpty(zxing)) {
        Bitmap bitmap = BarcodeCreater.creatBarcode(mContext, zxing, 100, 20, false);

        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
        Image image = Image.getInstance(stream.toByteArray());

        Chunk c1 = new Chunk(image, 0, 0, false);
        float width = image.getWidth();
        Chunk c2 = new Chunk(image, 595 - 30 * 2 - width * 2, 0, false);
        Paragraph pp = new Paragraph();
        pp.setLeading(30f);/*from ww w.  j  av  a  2s.c om*/
        pp.add(c1);
        pp.add(c2);
        document.add(pp);
    }
}

From source file:com.kohmiho.mpsr.export.PDFGenerator.java

private void addImage(Document document, String filename, String caption, Font font, int indentationLeft,
        int spacingBefore, int spacingAfter)
        throws BadElementException, MalformedURLException, IOException, DocumentException {

    if (null == filename) {
        addParagraph(document, null, null, String.format("[*** No Picture for %s ***]", caption), font,
                indentationLeft, 0, 0);/*from w ww.  j  a  v  a  2s  .c  o  m*/
        return;
    }

    try {
        Paragraph paragraph = new Paragraph();
        paragraph.setIndentationLeft(indentationLeft);
        paragraph.setSpacingBefore(spacingBefore);
        paragraph.setSpacingAfter(spacingAfter);
        if (null != font)
            paragraph.setFont(font);
        paragraph.setKeepTogether(true);
        paragraph.setAlignment(Element.ALIGN_CENTER);

        Image image = Image.getInstance(filename);
        image.scaleToFit(400, 400);

        paragraph.add(new Chunk(image, 0, 0, true));
        paragraph.add(new Chunk("\n"));
        paragraph.add(caption);
        document.add(paragraph);
    } catch (Exception e) {
        addParagraph(document, null, null, String.format("[*** Unable to render picture for %s ***]", caption),
                font, indentationLeft, 0, 0);
    }
}

From source file:com.masscustsoft.service.ToPdf.java

License:Open Source License

/**
 * Processes an Image./*w  ww.  j a  v  a  2  s . c  om*/
 * @param img
 * @param attrs
 * @throws DocumentException
 * @since   5.0.6
 */
public void processImage(final Image img, final Map<String, String> attrs) throws DocumentException {
    ImageProcessor processor = (ImageProcessor) providers.get(HTMLWorker.IMG_PROCESSOR);
    if (processor == null || !processor.process(img, attrs, chain, document)) {
        String align = attrs.get(HtmlTags.ALIGN);
        if (align != null) {
            carriageReturn();
        }
        if (currentParagraph == null) {
            currentParagraph = createParagraph();
        }
        currentParagraph.add(new Chunk(img, 0, 0, true));
        currentParagraph.setAlignment(HtmlUtilities.alignmentValue(align));
        if (align != null) {
            carriageReturn();
        }
    }
}

From source file:com.vectorprint.report.itext.mappingconfig.AbstractDatamappingProcessor.java

License:Open Source License

/**
 * attempts to add an element to a container
 *
 * @param container// www.j  a  v a2s  .  c  om
 * @param element
 * @throws DocumentException
 */
@Override
public void addToContainer(Element container, Element element) throws DocumentException, VectorPrintException {
    if (container instanceof TextElementArray) {
        if (element instanceof Image) {
            ((TextElementArray) container).add(new Chunk((Image) element, 0, 0, true));
        } else {
            ((TextElementArray) container).add(element);
        }
    } else if (container instanceof PdfPTable) {
        if (element instanceof PdfPCell) {
            ((PdfPTable) container).addCell((PdfPCell) element);
        } else if (element instanceof Phrase) {
            ((PdfPTable) container).addCell((Phrase) element);
        } else if (element instanceof PdfPTable) {
            ((PdfPTable) container).addCell((PdfPTable) element);
        } else if (element instanceof Image) {
            ((PdfPTable) container).addCell((Image) element);
        } else {
            throw new VectorPrintException(String.format("don't know how to add %s to %s",
                    (element == null) ? "null" : element.getClass().getName(),
                    (container == null) ? "null" : container.getClass().getName()));
        }
    } else if (container instanceof PdfPCell) {
        if (element instanceof PdfPTable) {
            throw new VectorPrintException(String.format("use %s.%s if you want to nest tables",
                    CONTAINER_ELEMENT.class.getName(), CONTAINER_ELEMENT.NESTED_TABLE));
        }
        ((PdfPCell) container).addElement(element);
    } else if (container instanceof ColumnText) {
        ((ColumnText) container).addElement(element);
    } else {
        throw new VectorPrintException(String.format("don't know how to add %s to %s",
                (element == null) ? "null" : element.getClass().getName(),
                (container == null) ? "null" : container.getClass().getName()));
    }
}

From source file:com.vectorprint.report.itext.VectorPrintDocument.java

License:Open Source License

/**
 *
 * @param image// ww  w  . j av a  2s .  co m
 * @param hook
 * @param prefix
 * @param wrap
 * @return true when the image was added to the document
 * @throws DocumentException
 */
private boolean tracePosition(Image image, AddElementHook hook, String prefix, boolean wrap)
        throws DocumentException {
    String gt = prefix + hook.styleClass;
    if (wrap && image.hasAbsoluteX() && image.hasAbsoluteY()) {
        // tracing position when an image is absolutely positioned by wrapping it in a chunk
        Chunk wrapper = new Chunk(image, (Float.NaN == image.getAbsoluteX()) ? 0 : image.getAbsoluteX(),
                (Float.NaN == image.getAbsoluteY()) ? 0 : image.getAbsoluteY(), true);
        try {
            styleHelper.delayedStyle(wrapper, gt,
                    StyleHelper.getStylers(factory.getStylers(gt.replaceFirst(prefix, "")), Advanced.class),
                    eventHelper);
        } catch (VectorPrintException ex) {
            throw new DocumentException(ex);
        }
        return super.add(wrapper);
    } else {
        // the chunk will provide feedback on the actual x and y of the image when onGenericTag is fired,
        // the width and height of the image are passed to the eventhelper
        Chunk chunk = positionChunk();
        try {
            styleHelper.delayedStyle(chunk, gt,
                    StyleHelper.getStylers(factory.getStylers(gt.replaceFirst(prefix, "")), Advanced.class),
                    eventHelper, image);
        } catch (VectorPrintException ex) {
            throw new DocumentException(ex);
        }
        super.add(chunk);
        return false;
    }
}

From source file:Export.SeguroCoberturaViagem.java

private static void criarDoc(Document documento, ViagemBean vb, String numCriente, String user, Contrato c,
        int i) throws DocumentException, FileNotFoundException, IOException, BadElementException {
    BaseColor colorVermelho = new BaseColor(193, 51, 51);
    BaseColor coloAzul = new BaseColor(0, 0, 179);

    Font fontCabecalhoN = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 10.5f,
            Font.NORMAL, coloAzul);
    Font fontCabecalhoTitile = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 14.5f,
            Font.UNDERLINE, colorVermelho);
    Font fontTableSimple = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 8.5f);
    Font fontTableNegrito = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 8.5f);
    Font fontTableSimpleMenor = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f);
    Font fontTableItalico = FontFactory.getFont(Fontes.FONTBI, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f);
    Font fontTableNormal = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 8f);
    Font fontTableSimpleCausulas = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED,
            8.999999f);// w  w  w . j  a v  a 2s. c  om

    //        SimpleDateFormat sdf= new SimpleDateFormat("dd-MM-yyyy");

    Font fontCabecalhoNP = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 9.5f);
    Font fontCorpo = FontFactory.getFont(Fontes.FONT, BaseFont.WINANSI, BaseFont.EMBEDDED, 8.5f);
    Font fontCabecalhoNG = FontFactory.getFont(Fontes.FONTB, BaseFont.WINANSI, BaseFont.EMBEDDED, 16f,
            Font.UNDERLINE, coloAzul);

    PdfPTable pTableEmpresaPricipal = new PdfPTable(new float[] { 23f, 77f });
    pTableEmpresaPricipal.setWidthPercentage(92);
    PdfPTable pTableEmpresaInforImpres1 = new PdfPTable(1);
    PdfPTable pTableEmpresaInforImpres2 = 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 cellTabela1 = new PdfPCell(pTableEmpresaInforImpres2);
    cellTabela1.setBorder(0);

    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.addCell(cellTabela6);
    pTableEmpresaPricipal.addCell(cellTabela5);

    PdfPTable pTableTitulo = new PdfPTable(1);
    pTableTitulo.setWidthPercentage(92f);
    PdfPCell paragraphTitulo = new PdfPCell(new Phrase("SEGURO DE VIAGEM", fontCabecalhoTitile));
    paragraphTitulo.setHorizontalAlignment(Element.ALIGN_CENTER);
    paragraphTitulo.setBorder(0);
    pTableTitulo.addCell(paragraphTitulo);

    PdfPTable pTablePrincipalSegurado = new PdfPTable(new float[] { 55, 45 });
    pTablePrincipalSegurado.setWidthPercentage(92);
    Paragraph pa = new Paragraph(new Phrase("NOME DO SEGURADO: ", fontTableSimple));
    pa.add(new Phrase(vb.getInfoPessoaSegurada().get(i).getNomePessoaSegurada().toUpperCase(),
            fontTableNegrito));
    PdfPCell cellSegurado02 = new PdfPCell(pa);

    pa = new Paragraph(new Phrase("Endereo: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(vb.getInfoPessoaSegurada().get(i).getEndereco().toUpperCase(), fontTableNegrito));
    PdfPCell cellSegurado12 = new PdfPCell(pa);

    pa = new Paragraph(new Phrase("Data e Local de Nascimento: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(vb.getInfoPessoaSegurada().get(i).getDataNascFormatada().toUpperCase(),
            fontTableNegrito));
    pa.add(new Phrase(" EM", fontTableSimple));
    pa.add(new Phrase(" " + vb.getInfoPessoaSegurada().get(i).getLocalNascimento().toUpperCase(),
            fontTableNegrito));
    PdfPCell cellSegurado21 = new PdfPCell(pa);

    pa = new Paragraph(new Phrase("Sexo: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(vb.getInfoPessoaSegurada().get(i).getSexo().toUpperCase(), fontTableNegrito));
    pa.add(new Phrase("  Tel: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(vb.getInfoPessoaSegurada().get(i).getTelefone().toUpperCase(), fontTableNegrito));
    PdfPCell cellSegurado22 = new PdfPCell(pa);

    pa = new Paragraph(new Phrase("Aplice: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(vb.getInfoPessoaSegurada().get(i).getNumApolice().toUpperCase(), fontTableNegrito));
    PdfPCell cellSegurado31 = new PdfPCell(pa);

    String[] codCliente = vb.getInfoPessoaSegurada().get(i).getNumApolice().split("/");

    pa = new Paragraph(new Phrase("Cliente: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(((codCliente.length == 2) ? "TIN " + codCliente[1] : "TIN ").toUpperCase(),
            fontTableNegrito));
    PdfPCell cellSegurado32 = new PdfPCell(pa);

    pa = new Paragraph(new Phrase("Durao: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(vb.getInfoPessoaSegurada().get(i).getNumDias() + " DIAS", fontTableNegrito));
    PdfPCell cellSegurado41 = new PdfPCell(pa);

    pa = new Paragraph(new Phrase("Perodo: DE ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(sdfPot.format(vb.getInfoPessoaSegurada().get(i).getDataInicio()).toUpperCase(),
            fontTableNegrito));
    pa.add(new Phrase("  ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(((vb.getInfoPessoaSegurada().get(i).getDataFim() != null)
            ? sdfPot.format(vb.getInfoPessoaSegurada().get(i).getDataFim())
            : " ").toUpperCase(), fontTableNegrito));
    PdfPCell cellSegurado42 = new PdfPCell(pa);

    pa = new Paragraph(new Phrase("Data de Emisso: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(sdfPot.format(c.getDataContrato()).toUpperCase(), fontTableNegrito));
    PdfPCell cellSegurado51 = new PdfPCell(pa);

    pa = new Paragraph(new Phrase("Destino: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(
            ClienteDao.paisesSelected(vb.getInfoPessoaSegurada().get(i).getPaisDestino().toUpperCase()),
            fontTableNegrito));
    pa.add(new Phrase(" N de Pessoas: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase((i + 1) + "".toUpperCase(), fontTableNegrito));
    PdfPCell cellSegurado52 = new PdfPCell(pa);

    //        PASSAPORTE   BILHETE IDENTIDADE
    pa = new Paragraph(new Phrase("Meio de Identificao: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(
            (vb.getInfoPessoaSegurada().get(i).getTipoDoc().toUpperCase().equals("PASSAPORTE") ? "PASS"
                    : (vb.getInfoPessoaSegurada().get(i).getTipoDoc().toUpperCase().equals("BILHETE IDENTIDADE")
                            ? "BI"
                            : vb.getInfoPessoaSegurada().get(i).getTipoDoc().toUpperCase())),
            fontTableNegrito));
    pa.add(new Phrase(" N ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(vb.getInfoPessoaSegurada().get(i).getNumDoc().toUpperCase(), fontTableNegrito));
    PdfPCell cellSegurado61 = new PdfPCell(pa);

    pa = new Paragraph(new Phrase("Emitido EM: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(vb.getInfoPessoaSegurada().get(i).getLocalEmissao().toUpperCase() + " ".toUpperCase(),
            fontTableNegrito));
    pa.add(new Phrase(" em ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(vb.getInfoPessoaSegurada().get(i).getDataEmissaoFormatada().toUpperCase(),
            fontTableNegrito));
    PdfPCell cellSegurado62 = new PdfPCell(pa);

    pa = new Paragraph(new Phrase("Outras Informaes: ".toUpperCase(), fontTableSimple));
    pa.add(new Phrase(
            ((vb.getInfoPessoaSegurada().get(i).getOutrasInformacoes() == null) ? " "
                    : vb.getInfoPessoaSegurada().get(i).getOutrasInformacoes().toUpperCase()).toUpperCase(),
            fontTableNegrito));
    PdfPCell cellSegurado72 = new PdfPCell(pa);

    cellSegurado02.setBorder(0);
    cellSegurado02.setColspan(2);
    pTablePrincipalSegurado.addCell(cellSegurado02);
    cellSegurado12.setColspan(2);
    cellSegurado12.setBorder(0);
    pTablePrincipalSegurado.addCell(cellSegurado12);
    cellSegurado21.setBorder(0);
    pTablePrincipalSegurado.addCell(cellSegurado21);
    cellSegurado22.setBorder(0);
    pTablePrincipalSegurado.addCell(cellSegurado22);
    cellSegurado31.setBorder(0);
    pTablePrincipalSegurado.addCell(cellSegurado31);
    cellSegurado32.setBorder(0);
    pTablePrincipalSegurado.addCell(cellSegurado32);
    cellSegurado41.setBorder(0);
    pTablePrincipalSegurado.addCell(cellSegurado41);
    cellSegurado42.setBorder(0);
    pTablePrincipalSegurado.addCell(cellSegurado42);
    cellSegurado51.setBorder(0);
    pTablePrincipalSegurado.addCell(cellSegurado51);
    cellSegurado52.setBorder(0);
    pTablePrincipalSegurado.addCell(cellSegurado52);
    cellSegurado61.setBorder(0);
    pTablePrincipalSegurado.addCell(cellSegurado61);
    cellSegurado62.setBorder(0);
    pTablePrincipalSegurado.addCell(cellSegurado62);
    cellSegurado72.setBorder(0);
    cellSegurado72.setColspan(2);
    pTablePrincipalSegurado.addCell(cellSegurado72);

    PdfPTable pTableOtros = new PdfPTable(1);
    pTableOtros.setWidthPercentage(92f);
    //            PdfPCell paragraphOutros = new PdfPCell(new Phrase("Outros Informaes:",fontTableSimple));
    PdfPCell paragraphNotaDebito = new PdfPCell(new Phrase(" ", fontTableNegrito));
    PdfPCell paragraphAmbitoC = new PdfPCell(
            new Phrase("mbito de Cobertura/Condies Particulares:", fontTableSimple));

    //            paragraphOutros.setBorder(0);
    //            pTableOtros.addCell(paragraphOutros);
    paragraphNotaDebito.setBorder(0);
    pTableOtros.addCell(paragraphNotaDebito);
    paragraphAmbitoC.setBorder(0);
    paragraphAmbitoC.setPaddingBottom(5f);
    pTableOtros.addCell(paragraphAmbitoC);

    PdfPTable pTableCobertura = new PdfPTable(new float[] { 70, 30 });
    pTableCobertura.setWidthPercentage(92);
    PdfPCell cellTable11 = new PdfPCell(new Phrase("COBERTURA", fontTableNegrito));
    PdfPCell cellTable12 = new PdfPCell(new Phrase("Limites de Indemnizao", fontTableNegrito));
    PdfPCell cellTable21 = new PdfPCell(
            new Phrase("Depesas mdicas, Cirgias, Farmacutica e de Hospitalizao no Estrangeiro",
                    fontTableSimpleMenor));
    PdfPCell cellTable22 = new PdfPCell(new Phrase("Euros 30.000 Franquia: 80 Euros", fontTableSimpleMenor));
    PdfPCell cellTable31 = new PdfPCell(
            new Phrase("Acompanhamento da pessoa segura hospitalizada", fontTableSimpleMenor));
    PdfPCell cellTable32 = new PdfPCell(new Phrase("Dia: Euros 70/ Mximo:Euros 700", fontTableSimpleMenor));
    PdfPCell cellTable41 = new PdfPCell(
            new Phrase("Transporte de ida e volta de familiar e estadia", fontTableSimpleMenor));
    PdfPCell cellTable42 = new PdfPCell(new Phrase("Dia: Euros 70/ Mximo: Euros 700", fontTableSimpleMenor));
    PdfPCell cellTable51 = new PdfPCell(new Phrase("Prolongamento de estadia no Hotel", fontTableSimpleMenor));
    PdfPCell cellTable52 = new PdfPCell(new Phrase("Dia: Euros 40/ Mximo: Euros 400", fontTableSimpleMenor));
    PdfPCell cellTable61 = new PdfPCell(
            new Phrase("Repatriamento / Transporte sanitrio de feridos e doentes", fontTableSimpleMenor));
    PdfPCell cellTable62 = new PdfPCell(new Phrase("Ilimitado", fontTableSimpleMenor));
    PdfPCell cellTable71 = new PdfPCell(
            new Phrase("Repatriamento / Transporte aps a morte", fontTableSimpleMenor));
    PdfPCell cellTable72 = new PdfPCell(new Phrase("Ilimitado", fontTableSimpleMenor));
    PdfPCell cellTable81 = new PdfPCell(
            new Phrase("Transporte ou Repatriamento das restantes pessoas seguras", fontTableSimpleMenor));
    PdfPCell cellTable82 = new PdfPCell(new Phrase("Ilimitado", fontTableSimpleMenor));
    PdfPCell cellTable91 = new PdfPCell(
            new Phrase("Superviso de crianas no estrangeiro", fontTableSimpleMenor));
    PdfPCell cellTable92 = new PdfPCell(new Phrase("Ilimitado", fontTableSimpleMenor));
    PdfPCell cellTable101 = new PdfPCell(
            new Phrase("Regresso antecipado por falecimento de familiar", fontTableSimpleMenor));
    PdfPCell cellTable102 = new PdfPCell(new Phrase("Ilimitado", fontTableSimpleMenor));
    PdfPCell cellTable111 = new PdfPCell(
            new Phrase("Localizao e envio de medicamentos de urgncia", fontTableSimpleMenor));
    PdfPCell cellTable112 = new PdfPCell(new Phrase("Ilimitado", fontTableSimpleMenor));
    PdfPCell cellTable121 = new PdfPCell(
            new Phrase("Transporte ou repatriamento de bagagens", fontTableSimpleMenor));
    PdfPCell cellTable122 = new PdfPCell(
            new Phrase("Limite imposto pela Empresa Transportadora", fontTableSimpleMenor));
    PdfPCell cellTable131 = new PdfPCell(
            new Phrase("Adiantamento de fundos no estrangeiro", fontTableSimpleMenor));
    PdfPCell cellTable132 = new PdfPCell(new Phrase("Mximo: Euros 700", fontTableSimpleMenor));
    PdfPCell cellTable141 = new PdfPCell(new Phrase("Aconselhamento mdico", fontTableSimpleMenor));
    PdfPCell cellTable142 = new PdfPCell(new Phrase("Ilimitado", fontTableSimpleMenor));
    PdfPCell cellTable151 = new PdfPCell(
            new Phrase("Pagamento de despesas de comunicao", fontTableSimpleMenor));
    PdfPCell cellTable152 = new PdfPCell(new Phrase("Ilimitado", fontTableSimpleMenor));
    PdfPCell cellTable161 = new PdfPCell(new Phrase("Servios informativos", fontTableSimpleMenor));
    PdfPCell cellTable162 = new PdfPCell(new Phrase("Ilimitado", fontTableSimpleMenor));

    cellTable11.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable11);
    cellTable12.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable12);
    pTableCobertura.addCell(cellTable21);
    cellTable22.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable22);
    pTableCobertura.addCell(cellTable31);
    cellTable32.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable32);
    pTableCobertura.addCell(cellTable41);
    cellTable42.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable42);
    pTableCobertura.addCell(cellTable51);
    cellTable52.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable52);
    pTableCobertura.addCell(cellTable61);
    cellTable62.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable62);
    pTableCobertura.addCell(cellTable71);
    cellTable72.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable72);
    pTableCobertura.addCell(cellTable81);
    cellTable82.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable82);
    pTableCobertura.addCell(cellTable91);
    cellTable92.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable92);
    pTableCobertura.addCell(cellTable101);
    cellTable102.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable102);
    pTableCobertura.addCell(cellTable111);
    cellTable112.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable112);
    pTableCobertura.addCell(cellTable121);
    cellTable122.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable122);
    pTableCobertura.addCell(cellTable131);
    cellTable132.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable132);
    pTableCobertura.addCell(cellTable141);
    cellTable142.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable142);
    pTableCobertura.addCell(cellTable151);
    cellTable152.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable152);
    pTableCobertura.addCell(cellTable161);
    cellTable162.setHorizontalAlignment(Element.ALIGN_CENTER);
    pTableCobertura.addCell(cellTable162);

    PdfPTable pTableCausuala = new PdfPTable(1);
    pTableCausuala.setWidthPercentage(92);
    PdfPCell paragraphParaFamilha = new PdfPCell(new Phrase(
            "1. Para Famlia e/ou Grupo, fornecer uma lista anexada com outros detalhes necessrios.",
            fontTableSimpleCausulas));
    paragraphParaFamilha.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    paragraphParaFamilha.setPaddingBottom(7f);

    PdfPCell paragraphOPresente = new PdfPCell(new Phrase(
            "2. O presente Contrato baseia-se na proposta do Segurador e  regido pelos termos referidos nas "
                    + "Condies Gerais e Especiais e de Excluses anexadas ao presente documento.",
            fontTableSimpleCausulas));
    paragraphOPresente.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    paragraphOPresente.setPaddingBottom(7f);

    PdfPCell paragraphOPremio = new PdfPCell(new Phrase(
            "3. O Prmio pago no  reembolsvel excepto a rejeio da aplice pela Embaixada.",
            fontTableSimpleCausulas));
    paragraphOPremio.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    paragraphOPremio.setPaddingBottom(7f);

    PdfPCell paragraphOSeguro = new PdfPCell(new Phrase(
            "4. O Segurado declara que as informaes prestadas so verdadeiras e completas e declara ter "
                    + "lido as condies Gerais e Especiais e as Excluses e concordado com as disposies nelas contidas.",
            fontTableSimpleCausulas));
    paragraphOSeguro.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    paragraphOSeguro.setPaddingBottom(7f);

    PdfPCell paragraphSolitacao = new PdfPCell(new Phrase(
            "5. Solicitao de reembolso deve ser feita por carta dirigida a Directora Geral da NICON Seguros STP, "
                    + "3 dias antes da data de inicio do seguro, e deve ser acompanhada da aplice original e da fotocpia da carta de rejeio da Embaixada.",
            fontTableSimpleCausulas));
    paragraphSolitacao.setHorizontalAlignment(Element.ALIGN_JUSTIFIED);
    //            paragraphSolitacao.setPaddingBottom(7f);

    paragraphParaFamilha.setBorder(0);
    pTableCausuala.addCell(paragraphParaFamilha);
    paragraphOPresente.setBorder(0);
    pTableCausuala.addCell(paragraphOPresente);
    paragraphOPremio.setBorder(0);
    pTableCausuala.addCell(paragraphOPremio);
    paragraphOSeguro.setBorder(0);
    pTableCausuala.addCell(paragraphOSeguro);
    paragraphSolitacao.setBorder(0);
    pTableCausuala.addCell(paragraphSolitacao);

    PdfPTable pTableNota = new PdfPTable(1);
    pTableNota.setWidthPercentage(92);
    PdfPCell paragraphNota = new PdfPCell(new Phrase(
            " condio indispensvel para usufruir das garantias deste contrato que o Subscritor ou Pessoas Seguradas contactem de imediato:",
            fontTableItalico));
    paragraphNota.setBorder(0);
    pTableNota.addCell(paragraphNota);

    PdfPTable pTableRotape = new PdfPTable(1);
    pTableRotape.setWidthPercentage(92);
    Paragraph p = new Paragraph();
    Image imageRotape = Image.getInstance(ConfigDoc.Fontes.getDiretorio() + "/europ-assistance2.jpg");
    imageRotape.scaleToFit(90, 40);
    p.add(new Chunk(imageRotape, 1, 1, true));

    Phrase phraseRodape = new Phrase(
            ", COMPAINHA PORTUGUESA DE SEGUROS DE ASSISTNCIA, Tel. 351 21 384 80 97 Fax: 351 21 386 03 08 www.europ-assitance.pt",
            fontTableNormal);
    p.add(phraseRodape);

    PdfPCell cellRodape = new PdfPCell(p);
    cellRodape.setPaddingTop(10f);
    cellRodape.setBorder(0);
    pTableRotape.addCell(cellRodape);

    PdfPTable pTableAsinatura = new PdfPTable(2);
    pTableAsinatura.setWidthPercentage(92);
    PdfPCell cellSeguradora = new PdfPCell(new Phrase("A Seguradora", fontTableSimpleCausulas));
    cellSeguradora.setBorder(0);
    cellSeguradora.setPaddingTop(25);
    cellSeguradora.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPCell cellSegurado = new PdfPCell(new Phrase("O Segurado", fontTableSimpleCausulas));
    cellSegurado.setPaddingTop(25);
    cellSegurado.setBorder(0);
    cellSegurado.setHorizontalAlignment(Element.ALIGN_CENTER);

    PdfPCell cellSeguradoValor = new PdfPCell(
            new Phrase("____________________________", fontTableSimpleCausulas));
    cellSeguradoValor.setBorder(0);
    cellSeguradoValor.setHorizontalAlignment(Element.ALIGN_CENTER);

    pTableAsinatura.addCell(cellSeguradora);
    pTableAsinatura.addCell(cellSegurado);
    pTableAsinatura.addCell(cellSeguradoValor);
    pTableAsinatura.addCell(cellSeguradoValor);

    //        documento.open();
    documento.add(pTableEmpresaPricipal);
    documento.add(pTableTitulo);
    documento.add(pTableNull);
    documento.add(pTablePrincipalSegurado);
    documento.add(pTableOtros);
    //            documento.add(pTableNull);
    documento.add(pTableCobertura);
    documento.add(pTableNull);
    documento.add(pTableCausuala);
    documento.add(pTableNull);
    documento.add(pTableNota);
    documento.add(pTableRotape);
    documento.add(pTableNull);
    documento.add(pTableAsinatura);

    if ((i + 1) != vb.getInfoPessoaSegurada().size())
        documento.newPage();

    //PrintPdf printPdf = new PrintPdf("Cobertura Viagem.pdf", "Cobertura Viagem.pdf", 0, 595f,842f,"Enviar Para o OneNote 2013",1);
    //            PrintPdf printPdf = new PrintPdf("Cobertura Viagem.pdf", "Cobertura Viagem.pdf", 0, 595f,842f,"Hewlett-Packard HP LaserJet P2035",1);

    //            printPdf.print();
}