title: iText PDF Creation Error
body: <p>I am using iText to create a PDF File from my Java file using NetBeans 8.2 . I have downloaded the iText JAR files from <a href="https://sourceforge.net/projects/itext/files/" rel="nofollow noreferrer">here</a>. My iText version is 7.0.2.</p>
  
  <p>Here is the partial code (I am only including the import files and code related to iText from my Java File):<br>
  <strong>Attendance.java</strong></p>
  
  <pre><code>import com.itextpdf.kernel.pdf.PdfDocument;
  import com.itextpdf.kernel.pdf.PdfReader;
  import com.itextpdf.kernel.pdf.PdfWriter;
  import com.itextpdf.layout.Document;
  import com.itextpdf.layout.element.Paragraph;
  
  .
  .
  .
  .
  
  try {
      OutputStream output = new FileOutputStream(new File("C:\\Users\\dell\\Desktop\\Attendance.pdf"));
      DefaultListModel model1 = (DefaultListModel)present.getModel();            
      Document doc = new Document();
      PdfWriter.getInstance(doc, output);
      doc.open();
      for (int i = 0; i &lt; 68; i++) {
          doc.add(new Paragraph((String) model1.getElementAt(i)));
      }                      
  } catch (FileNotFoundException ex) {
      Logger.getLogger(Attendance.class.getName()).log(Level.SEVERE, null, ex);
  }
  </code></pre>
  
  <p>Problem:</p>
  
  <p>I am getting the following 3 errors:</p>
  
  <ol>
  <li><blockquote>
    <p>no suitable constructor found for Document(no arguments)</p>
  </blockquote></li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/obaQn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/obaQn.png" alt="Document Error"></a></p>
  
  <ol start="2">
  <li><blockquote>
    <p>cannot find symbol: getInstance(Document, OutputStream)</p>
  </blockquote></li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/0N6jG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0N6jG.png" alt="getInstance"></a></p>
  
  <ol start="3">
  <li><blockquote>
    <p>cannot find symbol: open()</p>
  </blockquote></li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/cZFrl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cZFrl.png" alt="open"></a></p>
  
  <p>I have followed a lot of tutorials like <a href="https://howtodoinjava.com/apache-commons/create-pdf-files-in-java-itext-tutorial/" rel="nofollow noreferrer">this</a>, yet somehow they did not face the error I am facing even though I have used the same code. If someone has used iText to do such a thing, any advice would be appreciated. Let me know if you need any more information.</p>