List of usage examples for com.itextpdf.text Chapter setNumberDepth
public void setNumberDepth(final int numberDepth)
From source file:project1.SimplePdf.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: int id;// w w w . j a va 2s. c om String name; id = Integer.parseInt(txtid.getText()); name = txtname.getText(); try { OutputStream file = new FileOutputStream(new File("F:\\PDFFILES\\" + id + ".pdf")); Document document = new Document(); PdfWriter.getInstance(document, file); document.open(); // Image im=Image.getInstance("E:\\PDFFILES\\FUUAST.png"); // document.add(new Paragraph("")); // document.add(im); Paragraph title1 = new Paragraph(name + id, FontFactory.getFont(FontFactory.HELVETICA, 36, Font.BOLDITALIC, new CMYKColor(0, 255, 255, 17))); Chapter chapter1 = new Chapter(title1, 1); chapter1.setNumberDepth(0); document.add(chapter1); document.add(new Paragraph("\n\n\n\n")); document.add(new Paragraph("Name: " + name)); document.add(new Paragraph("Id: " + id)); try { Desktop desktop = Desktop.getDesktop(); if (desktop.isSupported(Desktop.Action.OPEN)) { desktop.open(new File("D:\\PDFFILES\\" + id + ".pdf")); } else { System.out.println("Open is not supported"); } } catch (IOException exp) { exp.printStackTrace(); } document.close(); file.close(); } catch (Exception e) { e.printStackTrace(); } }