public static Font getFont(ReportColumnInfo info) {
   if (info != null) {
     return new Font(info.getFontFamily(), info.getFontSize(), info.getFontStyle());
   } else {
     return new Font();
   }
 }
  public static MemoryFileBuffer writeStickerList(Report report, ReportInfo info) {
    Connection Conn = null;
    Statement stmt = null;
    ResultSet RS = null;

    MemoryFileBuffer buffer = new MemoryFileBuffer();
    MemoryOutputStream mos = new MemoryOutputStream(buffer);

    try {
      String[] Headers = report.getHeaders();
      int Hlen = Headers.length;
      String sql = report.getSQL();
      // String file = realpath;
      List cinfos = ReportFinder.listOfReportColumnInfo(report.getID());
      ReportColumnInfo rinfo;

      String[] endstrings = new String[Hlen];
      Font[] fonts = new Font[Hlen];
      int[] spans = new int[Hlen];

      int listsize = cinfos != null ? cinfos.size() : 0;
      for (int i = 0; i < Hlen; i++) {
        if (i < listsize) {
          rinfo = (ReportColumnInfo) cinfos.get(i);
          fonts[i] = getFont(rinfo);
          /** @todo endstring fix */
          endstrings[i] = "\n";
          spans[i] = rinfo.getColumnSpan();
        } else {
          fonts[i] = getFont(null);
          endstrings[i] = "\n";
          spans[i] = 1;
        }
      }

      Conn = com.idega.util.database.ConnectionBroker.getConnection();
      stmt = Conn.createStatement();
      RS = stmt.executeQuery(sql);
      StickerList list = new StickerList();
      list.setStickerHeight(info.getHeight());
      list.setStickerWidth(info.getWidth());
      list.setBorder(info.getBorder());
      list.setRotation(info.getLandscape());
      list.setPageSize(ReportFinder.getPageSize(info.getPagesize()));

      Paragraph parag;
      while (RS.next()) {
        parag = new Paragraph();

        for (int i = 1; i <= Hlen; i++) {
          String s = RS.getString(i);
          // if(!RS.wasNull())
          if (s != null) {
            parag.add(new Chunk(s, fonts[i - 1]));
          }
          // parag.add(new Chunk(RS.getString(i),fonts[i-1]));
          parag.add(endstrings[i - 1]);
        }
        list.add(parag);
      }
      StickerWriter.print(mos, list);
    } catch (Exception ex) {
      ex.printStackTrace();
    } finally {
      // do not hide an existing exception
      try {
        if (RS != null) {
          RS.close();
        }
      } catch (SQLException resultCloseEx) {
        System.err.println("[StickerReport] result set could not be closed");
        resultCloseEx.printStackTrace(System.err);
      }
      // do not hide an existing exception
      try {
        if (stmt != null) {
          stmt.close();
          ConnectionBroker.freeConnection(Conn);
        }
      } catch (SQLException statementCloseEx) {
        System.err.println("[StickerReport] statement could not be closed");
        statementCloseEx.printStackTrace(System.err);
      }
    }
    buffer.setMimeType("application/pdf");
    return buffer;
  }