I have a jframe with jtable, Button, and Jlabel. I have a problem When I click the button it appears that saved to pdf just fill in the table, but no column name. And what if I also want to add jlabel into pdf file??
It's the script :
Private void print(){ 
Document document = new Document(PageSize.A4.rotate());
try {
  PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("D:/jTable.pdf"));
  document.open();
  PdfContentByte cb = writer.getDirectContent();
  cb.saveState();
  Graphics2D g2 = cb.createGraphicsShapes(500, 500);
  Shape oldClip = g2.getClip();
  g2.clipRect(0, 0, 500, 500);
  table_pdf.print(g2);
  g2.setClip(oldClip);
  g2.dispose();
  cb.restoreState();
} catch (Exception e) {
  System.err.println(e.getMessage());
}
document.close();}
it's screenshoot

and it's file pdf
