Пример #1
0
  public byte[] generaArcSol(
      final List<VUSolicitud> listSolic, final String titulo, final String firmaDigital)
      throws VUException {

    final Document document = new Document(PageSize.A4, 10, 10, 10, 70);
    final ByteArrayOutputStream bOutput = new ByteArrayOutputStream();
    try {
      final PdfWriter writer = PdfWriter.getInstance(document, bOutput);

      final HeaderFooter event =
          new HeaderFooter(this.footer(), filesBean.getFileSctImg().getURL().getPath(), titulo);
      writer.setPageEvent(event);

      document.open();
      document.add(new Paragraph(" "));
      document.add(this.cuerpoSol(listSolic));

      final PdfPTable tabPDF = getTablaPDF(firmaDigital);
      document.add(tabPDF);
    } catch (Exception expo) {
      LOGVU.error("ERRROR al generar PDF", expo);
    } finally {
      if (null != document) {
        document.close();
      }
    }
    return bOutput.toByteArray();
  }
Пример #2
0
  public byte[] pdf(
      List<String> listaHeaderTablePdf, Map<String, String> mapaPdf, String firmaDigital)
      throws DocumentException, IOException {

    String rutaPdf = null;
    PdfWriter writer = null;
    HeaderFooter event = null;
    String titulo = null;
    final Document document = new Document(PageSize.A4, 10, 10, 10, 70);
    final ByteArrayOutputStream bOutput = new ByteArrayOutputStream();
    try {
      rutaPdf = messageSource.getMessage("generaPdf.pdf.rutaPdf", null, Locale.getDefault());
      titulo = messageSource.getMessage("generaPdf.pdf.DGAF", null, Locale.getDefault());
      writer = PdfWriter.getInstance(document, bOutput);
      event =
          new HeaderFooter(
              filesBean.getFileSctImg().getURL().getPath(),
              filesBean.getFileImgSello().getURL().getPath(),
              footer(),
              titulo);
      writer.setPageEvent(event);

      document.open();
      LOGVU.info("Inicia Generacion de PDF");
      document.add(new Paragraph(" "));
      //		    cuerpo(listaHeaderTablePdf, mapaPdf);
      document.add(this.cuerpo(listaHeaderTablePdf, mapaPdf));
      final PdfPTable tablaPDF = getTablaPDF(firmaDigital);

      document.add(tablaPDF);
      // document.close();
      LOGVU.info("PDF GENERADO CORRECTAMENTE");
    } catch (Exception expo) {
      LOGVU.error("error al generar PDF", expo);
    } finally {
      if (null != document) {
        document.close();
      }
    }
    return bOutput.toByteArray();
  }