title: nullpointerexception in a PageFormat variable
body: <p>im trying to print a JPanel with a lot of contents and it's a bit huge and need to know the num of pages and the Page format. But when i try to know these things in a lane crash and i have a nullpointer exception.</p>
  
  <p>this is a short piece of code:</p>
  
  <pre><code>private Component componentToBePrinted;
  private PageFormat format;
  private int numPages;
  
  componentToBePrinted = this.PanelMatricula;
  Dimension page = this.componentToBePrinted.getPreferredSize();
  
  numPages = (int) Math.ceil(page.height/format.getImageableY());// Nullpointerexception 
  print(componentToBePrinted.getGraphics(), format, this.getNumberOfPages());
  </code></pre>
  
  <p>Im new in the wolrd of the printing and i don't know what's the fail, i researched a lot and don't find any solution.</p>
  
  <p>Thanks all for the help.</p>