private PdfPTable buildHeader(String date) throws BadElementException, IOException {
    PdfPCell cell;
    PdfPTable table = new PdfPTable(3);
    table.setWidthPercentage(100);
    table.getDefaultCell().setBorder(0);

    Resource r = appContex.getResource("/img/logo_mairie.png");
    Image img = Image.getInstance(r.getFile().getAbsolutePath());
    cell = new PdfPCell();
    cell.addElement(new Chunk(img, 60, 0));
    cell.setFixedHeight(70);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setPaddingTop(23);
    cell.setBorder(Rectangle.NO_BORDER);
    cell.setRowspan(2);
    table.addCell(cell);

    cell = new PdfPCell(new Phrase("FICHE EVENEMENTIELLE", FONT_TITLE));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    Resource r2 = appContex.getResource("/img/logo_police_nc.jpg");
    Image img2 = Image.getInstance(r2.getFile().getAbsolutePath());
    cell = new PdfPCell();
    cell.addElement(new Chunk(img2, 130, 0));
    cell.setFixedHeight(70);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setPaddingTop(23);
    cell.setBorder(Rectangle.NO_BORDER);
    cell.setRowspan(2);
    table.addCell(cell);

    cell =
        new PdfPCell(
            new Phrase(
                "Fiche éditée le "
                    + date
                    + "\npar "
                    + authHelper.getCurrentUser().getAgent().getNom()
                    + " "
                    + authHelper.getCurrentUser().getAgent().getPrenom(),
                FONT_TITLE_LIGHT));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    cell.setBorder(Rectangle.NO_BORDER);
    table.addCell(cell);

    table.setSpacingBefore(5);
    table.setSpacingAfter(5);

    return table;
  }
  private Document buildMetadata(Document document, String date) {
    String author =
        authHelper.getCurrentUser().getAgent().getNom()
            + " "
            + authHelper.getCurrentUser().getAgent().getPrenom();
    document.addAuthor(author);
    document.addCreationDate();
    document.addCreator(author);
    document.addTitle("FICHE EVENEMENTIELLE " + date);
    document.addSubject("FICHE EVENEMENTIELLE " + date);

    return document;
  }
  private Document buildMetadata(Document document, Fiche fiche) {
    Agent a = fiche.getHistoriques().iterator().next().getUtilisateur().getAgent();
    document.addAuthor(a.getNom() + " " + a.getPrenom());
    document.addCreationDate();
    document.addCreator(
        authHelper.getCurrentUser().getAgent().getNom()
            + " "
            + authHelper.getCurrentUser().getAgent().getPrenom());
    document.addTitle("MAIN COURANTE " + fiche.getReference());
    document.addSubject("MAIN COURANTE " + fiche.getReference());

    StringBuilder keywords = new StringBuilder();
    keywords.append(fiche.getReference());
    keywords.append(",");
    keywords.append(fiche.getAdresse().getNomVoie().getLibelle());
    keywords.append(",");
    for (Fait f : fiche.getFaits()) {
      keywords.append(f.getNature().getLibelleCourt());
      keywords.append(",");
    }
    document.addKeywords(keywords.toString());

    return document;
  }