I am writing in java, but want to create a dynamic HTML-page for the users. I am using Lowagie to create the document with HTML. I do manage to present the html, but my picture is empty. It just contain the picture-border. Can anyone help me with this? Or tell me another way of creating HTML-pages (preferable by using ByteArrauOutputstream or other outpustreams to display the content).
The code is as follows:
 public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String orderId = request.getParameter("id1");
    String telephone = request.getParameter("id2");
    response.setHeader("Expires", EXPIRES);
    response.setContentType(CONTENT_TYPE);
    ServletOutputStream out = null;
    ByteArrayOutputStream baos = null;
    try {
        baos = getHtmlTicket(orderId, telephone);
        response.setContentLength(baos.size());
        out = response.getOutputStream();
        baos.writeTo(out);
    }
    catch (Exception e) {
        log.error(e.getMessage(), e);
    }
    finally {
        if (out != null) {
            try {
                out.flush();
            }
            catch (Exception e) {
                log.debug(e.getMessage(), e);
            }
        }
        if (baos != null) {
            try {
                baos.flush();
            }
            catch (Exception e) {
                log.debug(e.getMessage(), e);
            }
        }
        if (out != null) {
            try {
                out.close();
            }
            catch (Exception e) {
                log.warn(e.getMessage(), e);
            }
        }
        if (baos != null) {
            try {
                baos.close();
            }
            catch (Exception e) {
                log.warn(e.getMessage(), e);
            }
        }
    }
  public ByteArrayOutputStream getHtmlTicket(String orderId, String   telephoneTest) {
  ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
    Document document = new Document();
    Order order = orderService.getOrder(Integer.parseInt(orderId));
    String fileType = "png";
    String filePath = "html/picture.png";
    File myFile = new File(filePath);
    try {
        HtmlWriter.getInstance(document, baos);
        document.open();
        document.add(new Paragraph("Hello World"));
        Image fileImage = Image.getInstance(filePath);
        document.add(fileImage);
        document.add(new Paragraph("osv"));
    }
    catch (DocumentException e) {
        e.printStackTrace();
    }
    catch (IOException e) {
        e.printStackTrace();
    }
    document.close();
    return baos;
 }