# Fuentes en las celdas

```java
PdfPCell cellMision = new PdfPCell(new Paragraph(pv.getMision(), FontFactory.getFont("arial", 9, Font.NORMAL)));
```

![](/files/-Lo7NVDJ-xpaP9mgvkcv)

Definimos el tamaño de fuente mas pequeño para mision.

### Método

```java
 public void imprimir() {

//        com.lowagie.text.Document document = new com.lowagie.text.Document(PageSize.LETTER);
        com.lowagie.text.Document document = new com.lowagie.text.Document(PageSize.A4.rotate());
        
              
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            PdfWriter.getInstance(document, baos);
            //METADATA

            document.open();

            document.add(new Paragraph(" PROGRAMACION DE FLOTA VEHICULAR \n"));

            DateFormat formatter = new SimpleDateFormat("dd/MM/yy '-' hh:mm:ss:");
            Date currentDate = new Date();
            String date = formatter.format(currentDate);
            document.add(new Paragraph("Fecha Generado: " + date));
            document.add(new Paragraph("\n"));

            PdfPTable table = new PdfPTable(7);

//                  table.setTotalWidth(new float[]{ 20,72, 110, 95, 170, 72 });
            table.setTotalWidth(new float[]{20, 100,85,85,225, 72, 110});
            table.setLockedWidth(true);

            PdfPCell cell = new PdfPCell(new Paragraph("id",
                    FontFactory.getFont("arial", // fuente
                            12, // tamaño
                            Font.BOLD)));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER);

            cell.setColspan(1);
            table.addCell(cell);

          //  cell = new PdfPCell(new Paragraph("ID", FontFactory.getFont("arial", 8, Font.BOLD)));

            table.addCell("fechapartida");
            table.addCell("dia");
            table.addCell("unidad");
            table.addCell("mision");
            
            table.addCell("conductor");

            table.addCell("placa");

            for (ProgramacionVehicular pv : programacionVehicular) {
                String date1 = formatter.format(pv.getFechahorasalida());

                table.addCell(pv.getIdviaje().toString());
                table.addCell(date1);
                table.addCell(pv.getNombredia());
                table.addCell(pv.getUnidad());
               PdfPCell cellMision = new PdfPCell(new Paragraph(pv.getMision(), FontFactory.getFont("arial", 9, Font.NORMAL)));
                table.addCell(cellMision );
//                table.addCell(pv.getMision());
                table.addCell(pv.getConductor());
                table.addCell(pv.getPlaca());

            }
            document.add(table);
        } catch (Exception ex) {
            System.out.println("Error " + ex.getMessage());
        }
        document.close();
        FacesContext context = FacesContext.getCurrentInstance();
        Object response = context.getExternalContext().getResponse();
        if (response instanceof HttpServletResponse) {
            HttpServletResponse hsr = (HttpServletResponse) response;
            hsr.setContentType("application/pdf");
            hsr.setHeader("Contentdisposition", "attachment;filename=report.pdf");
            //        hsr.setHeader("Content-disposition", "attachment");
            hsr.setContentLength(baos.size());
            try {
                ServletOutputStream out = hsr.getOutputStream();
                baos.writeTo(out);
                out.flush();
            } catch (IOException ex) {
                System.out.println("Error:  " + ex.getMessage());
            }
            context.responseComplete();
        }
    }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://avbravo-2.gitbook.io/trucosjakartaee/reportes/pdfbox-reportes/fuentes-en-las-celdas.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
