Package com.itextpdf.text

Examples of com.itextpdf.text.Chunk


     */
    public PdfOutline(PdfOutline parent, PdfDestination destination, Paragraph title, boolean open) {
        super();
        StringBuffer buf = new StringBuffer();
        for (Object element : title.getChunks()) {
            Chunk chunk = (Chunk) element;
            buf.append(chunk.getContent());
        }
        this.destination = destination;
        initOutline(parent, buf.toString(), open);
    }
View Full Code Here


    }

    private Phrase composePhrase(String text, BaseFont ufont, BaseColor color, float fontSize) {
        Phrase phrase = null;
        if (extensionFont == null && (substitutionFonts == null || substitutionFonts.isEmpty()))
            phrase = new Phrase(new Chunk(text, new Font(ufont, fontSize, 0, color)));
        else {
            FontSelector fs = new FontSelector();
            fs.addFont(new Font(ufont, fontSize, 0, color));
            if (extensionFont != null)
                fs.addFont(new Font(extensionFont, fontSize, 0, color));
View Full Code Here

                    app.setGrayFill(0);
                else
                    app.setColorFill(textColor);
                app.beginText();
                for (int k = 0; k < phrase.size(); ++k) {
                    Chunk ck = (Chunk)phrase.get(k);
                    BaseFont bf = ck.getFont().getBaseFont();
                    app.setFontAndSize(bf, usize);
                    StringBuffer sb = ck.append("");
                    for (int j = 0; j < sb.length(); ++j) {
                        String c = sb.substring(j, j + 1);
                        float wd = bf.getWidthPoint(c, usize);
                        app.setTextMatrix(extraMarginLeft + start - wd / 2, offsetY - extraMarginTop);
                        app.showText(c);
View Full Code Here

     * @param arabicOptions
     * @return the String with the ligatures
     */
    public static String processLTR(String s, int runDirection, int arabicOptions) {
      BidiLine bidi = new BidiLine();
      bidi.addChunk(new PdfChunk(new Chunk(s), null));
      bidi.arabicOptions = arabicOptions;
      bidi.getParagraph(runDirection);
      ArrayList<PdfChunk> arr = bidi.createArrayOfPdfChunks(0, bidi.totalTextLength - 1);
      StringBuilder sb = new StringBuilder();
      for (PdfChunk ck : arr) {
View Full Code Here

        if (fit) {
            this.image = image;
            setPadding(borderWidth / 2);
        }
        else {
            column.addText(this.phrase = new Phrase(new Chunk(image, 0, 0, true)));
            setPadding(0);
        }
    }
View Full Code Here

    img.scaleToFit((width / columns) - 10, h);
    PdfPCell imgCell = new PdfPCell(img);
    imgCell.setBorder(0);
   
    /* title */
    Paragraph titleParagraph = new Paragraph(new Chunk(filename.substring(0, filename.indexOf('.'))));
    PdfPCell titleCell = new PdfPCell(titleParagraph);
    titleCell.setPaddingBottom(5F);
    titleCell.setBorder(0);
    titleCell.setFixedHeight(30F);
    switch(titlePosition) {
View Full Code Here

                imageR.setVerticalAlignment(Element.ALIGN_CENTER);
            }
        }

        table.addCell(imageL);
        Chunk par = new Chunk(this.reportSettingsProperties.loadTitle());
        par.setFont(new Font(this.fontMapper.awtToPdf(this.reportSettingsProperties.loadTitleFont())));
        Paragraph enc = new Paragraph(par);
        enc.setAlignment(Element.ALIGN_CENTER);
        PdfPCell cell = new PdfPCell();
        cell.addElement(enc);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
View Full Code Here

    @Override
    protected void buildPatientInfo(Analysis analysis) throws DocumentException {

        Patient patient = analysis.getPatient();
        Chunk pat = new Chunk(EntityDescriptions.PATIENT + ": " + patient.getFullName());
        pat.setFont(new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD));
        this.document.add(pat);
        this.document.add(Chunk.NEWLINE);
        this.document.add(Chunk.NEWLINE);

        Medic medic = analysis.getMedic();
        if (medic != null) {
            Chunk med = new Chunk(ReportTexts.request_by + medic.getFullName());
            med.setFont(new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD));
            this.document.add(med);
            this.writeEmptyLine();
        }

        int amount = this.getAmountOfData();

        if (amount > 0) {
            PdfPTable patientTable = new PdfPTable(amount);
            patientTable.setWidthPercentage(90);

            Font title = new Font(this.fontMapper.awtToPdf(this.reportSettingsProperties.loadDataFont()));
            Font value = new Font(this.fontMapper.awtToPdf(this.reportSettingsProperties.loadDataValueFont()));

            // PUT HEADERS

            if (this.reportSettingsProperties.loadUseAge()) {
                Chunk a = new Chunk("Edad");
                a.setFont(title);
                PdfPCell ages = new PdfPCell(new Paragraph(a));
                ages.setHorizontalAlignment(Element.ALIGN_CENTER);
                ages.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(ages);
            }

            if (this.reportSettingsProperties.loadUseWeight()) {
                Chunk p = new Chunk("Peso" + System.getProperty("line.separator") + Units.kilograms);
                p.setFont(title);
                PdfPCell weight = new PdfPCell(new Paragraph(p));
                weight.setHorizontalAlignment(Element.ALIGN_CENTER);
                weight.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(weight);
            }

            if (this.reportSettingsProperties.loadUseHeight()) {
                Chunk h = new Chunk("Altura" + System.getProperty("line.separator") + Units.Centimetres);
                h.setFont(title);
                PdfPCell height = new PdfPCell(new Paragraph(h));
                height.setHorizontalAlignment(Element.ALIGN_CENTER);
                height.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(height);
            }

            if (this.reportSettingsProperties.loadUsePS()) {
                Chunk pss = new Chunk("PS" + System.getProperty("line.separator") + Units.pressure);
                pss.setFont(title);
                PdfPCell ps = new PdfPCell(new Paragraph(pss));
                ps.setHorizontalAlignment(Element.ALIGN_CENTER);
                ps.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(ps);
            }

            if (this.reportSettingsProperties.loadUsePD()) {
                Chunk pdd = new Chunk("PD" + System.getProperty("line.separator") + Units.pressure);
                pdd.setFont(title);
                PdfPCell pd = new PdfPCell(new Paragraph(pdd));
                pd.setHorizontalAlignment(Element.ALIGN_CENTER);
                pd.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(pd);
            }

            if (this.reportSettingsProperties.loadUseSmoke()) {
                Chunk sm = new Chunk("Fuma");
                sm.setFont(title);
                PdfPCell smooke = new PdfPCell(new Paragraph(sm));
                smooke.setHorizontalAlignment(Element.ALIGN_CENTER);
                smooke.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(smooke);
            }

            // PUT DATA

            if (this.reportSettingsProperties.loadUseAge()) {
                Chunk years = new Chunk(patient.getAge().toString());
                years.setFont(value);
                PdfPCell agesValue = new PdfPCell(new Paragraph(years));
                agesValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                agesValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(agesValue);
            }

            if (this.reportSettingsProperties.loadUseWeight()) {
                Chunk weightP = new Chunk(analysis.getClinicalInformation().getWeightAsString(false));
                weightP.setFont(value);
                PdfPCell weightValue = new PdfPCell(new Paragraph(weightP));
                weightValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                weightValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(weightValue);
            }

            if (this.reportSettingsProperties.loadUseHeight()) {
                Chunk heightP = new Chunk(analysis.getClinicalInformation().getHeightAsString(false));
                heightP.setFont(value);
                PdfPCell heightValue = new PdfPCell(new Paragraph(heightP));
                heightValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                heightValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(heightValue);
            }

            if (this.reportSettingsProperties.loadUsePS()) {
                Chunk psCk = new Chunk(analysis.getClinicalInformation().getSystolicPressureAsString(false));
                psCk.setFont(value);
                PdfPCell psValue = new PdfPCell(new Paragraph(psCk));
                psValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                psValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(psValue);
            }

            if (this.reportSettingsProperties.loadUsePD()) {
                Chunk pdCk = new Chunk(analysis.getClinicalInformation().getDiastolicPressureAsString(false));
                pdCk.setFont(value);
                PdfPCell pdValue = new PdfPCell(new Paragraph(pdCk));
                pdValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                pdValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(pdValue);
            }

            if (this.reportSettingsProperties.loadUseSmoke()) {
                Chunk smk = new Chunk(patient.getClinicalHistoryProxy().getIsSmoker());
                smk.setFont(value);
                PdfPCell smookeValue = new PdfPCell(new Paragraph(smk));
                smookeValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                smookeValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                patientTable.addCell(smookeValue);
            }
View Full Code Here

            indicesTable.setWidthPercentage(90);

            // PUT HEADER

            if (this.reportSettingsProperties.loadUseAOD()) {
                Chunk amp = new Chunk("Amplitud OD" + System.getProperty("line.separator") + Units.amplitude);
                amp.setFont(indexFont);
                PdfPCell amplitud = new PdfPCell(new Paragraph(amp));
                amplitud.setHorizontalAlignment(Element.ALIGN_CENTER);
                amplitud.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(amplitud);
            }

            if (this.reportSettingsProperties.loadUseIAR()) {
                Chunk aume = new Chunk("Aumentación" + System.getProperty("line.separator") + Units.amplitude);
                aume.setFont(indexFont);
                PdfPCell aumentacion = new PdfPCell(new Paragraph(aume));
                aumentacion.setHorizontalAlignment(Element.ALIGN_CENTER);
                aumentacion.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(aumentacion);
            }

            if (this.reportSettingsProperties.loadUseAOS()) {
                Chunk an = new Chunk("Ancho 50% OS" + System.getProperty("line.separator") + Units.miliseconds);
                an.setFont(indexFont);
                PdfPCell ancho = new PdfPCell(new Paragraph(an));
                ancho.setHorizontalAlignment(Element.ALIGN_CENTER);
                ancho.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(ancho);
            }

            if (this.reportSettingsProperties.loadUseIMC()) {
                Chunk m = new Chunk("Masa Corporal");
                m.setFont(indexFont);
                PdfPCell masa = new PdfPCell(new Paragraph(m));
                masa.setHorizontalAlignment(Element.ALIGN_CENTER);
                masa.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(masa);
            }

            if (this.reportSettingsProperties.loadUseFC()) {
                Chunk f = new Chunk("Frecuencia Card." + System.getProperty("line.separator") + "[ppm]");
                f.setFont(indexFont);
                PdfPCell freq = new PdfPCell(new Paragraph(f));
                freq.setHorizontalAlignment(Element.ALIGN_CENTER);
                freq.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(freq);
            }

            if (this.reportSettingsProperties.loadUseRS()) {
                Chunk r = new Chunk("Reflejo Sist." + System.getProperty("line.separator") + Units.miliseconds);
                r.setFont(indexFont);
                PdfPCell rs = new PdfPCell(new Paragraph(r));
                rs.setHorizontalAlignment(Element.ALIGN_CENTER);
                rs.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(rs);
            }

            if (this.reportSettingsProperties.loadUseAOD()) {
                Chunk ampCk = new Chunk(analysisResult.getAod().getValueAsString());
                ampCk.setFont(indexValueFont);
                PdfPCell ampValue = new PdfPCell(new Paragraph(ampCk));
                ampValue.setHorizontalAlignment(Element.ALIGN_CENTER);
                ampValue.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(ampValue);
            }

            if (this.reportSettingsProperties.loadUseIAR()) {
                Chunk aumCk = new Chunk(analysisResult.getIar().getValueAsString());
                aumCk.setFont(indexValueFont);
                PdfPCell aum = new PdfPCell(new Paragraph(aumCk));
                aum.setHorizontalAlignment(Element.ALIGN_CENTER);
                aum.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(aum);
            }

            if (this.reportSettingsProperties.loadUseAOS()) {
                Chunk anchCk = new Chunk(analysisResult.getAos().getValueAsString());
                anchCk.setFont(indexValueFont);
                PdfPCell anch = new PdfPCell(new Paragraph(anchCk));
                anch.setHorizontalAlignment(Element.ALIGN_CENTER);
                anch.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(anch);
            }

            if (this.reportSettingsProperties.loadUseIMC()) {
                Chunk masCk = new Chunk(analysis.getClinicalInformation().getIMCasString());
                masCk.setFont(indexValueFont);
                PdfPCell mas = new PdfPCell(new Paragraph(masCk));
                mas.setHorizontalAlignment(Element.ALIGN_CENTER);
                mas.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(mas);
            }

            if (this.reportSettingsProperties.loadUseFC()) {
                Chunk freqCk = new Chunk(analysisResult.getHeartRateAsString());
                freqCk.setFont(indexValueFont);
                PdfPCell freqC = new PdfPCell(new Paragraph(freqCk));
                freqC.setHorizontalAlignment(Element.ALIGN_CENTER);
                freqC.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(freqC);
            }

            if (this.reportSettingsProperties.loadUseRS()) {
                Chunk rs = new Chunk(analysisResult.getT().getValueAsString());
                rs.setFont(indexValueFont);
                PdfPCell rsC = new PdfPCell(new Paragraph(rs));
                rsC.setHorizontalAlignment(Element.ALIGN_CENTER);
                rsC.setVerticalAlignment(Element.ALIGN_MIDDLE);
                indicesTable.addCell(rsC);
            }
View Full Code Here

        if (image != null) {
            float[] widithPlot = {0.5f, 1.5f};
            PdfPTable tablePlot = new PdfPTable(widithPlot);
            tablePlot.setWidthPercentage(70);
            tablePlot.setHorizontalAlignment(Element.ALIGN_CENTER);
            Chunk plot = new Chunk(this.reportSettingsProperties.loadPlotTitle());
            plot.setFont(new Font(fontMapper.awtToPdf(this.reportSettingsProperties.loadPlotFont())));
            PdfPCell plotTitle = new PdfPCell(new Paragraph(plot));

            plotTitle.setVerticalAlignment(Element.ALIGN_MIDDLE);
            plotTitle.setHorizontalAlignment(Element.ALIGN_CENTER);
            tablePlot.addCell(plotTitle);
View Full Code Here

TOP

Related Classes of com.itextpdf.text.Chunk

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.