Generate JPanel as a PDF.

 try
  {
    Document document   = new Document();
    PdfWriter writer    = PdfWriter.getInstance(document, new FileOutputStream("e:/test.pdf"));
    document.open();
    PdfContentByte contentByte = writer.getDirectContent();
    PdfTemplate template = contentByte.createTemplate(600, 600);
    Graphics2D g2 = template.createGraphics(600, 600);
    jPanel10.print(g2);
    g2.dispose();
    contentByte.addTemplate(template, 40, 400);

    document.close();

  }
  catch(Exception e)
  {
      System.out.println(e);
  }

Popular posts from this blog

Simple Sign up design. Android.

Cart page design in android.

Set Date on jDateChooser and retrieve record from database.