show preview and not all page/forms I need to show only the preview and not all page and forms

I made a new window after clicking preview but I see ALL page (a duplicate) including header, footer and form compiled. I need to show the preview only.

function node_form_build_preview($form, &amp;$form_state) {
  $node = node_form_submit_build_node($form, $form_state);
  $form_state['node_preview'] = node_preview($node);
}


can someone help?
If you dont like what Drupal is doing by default for this preview feature, override it in your site theme, there is an example of this in the node_preview Drupal 7 API node_preview() comments.

the comment incorrectly titles the function THEME_Node_preview() it should all be lowercase

  /**
   *Output customized node preview on node edit and add forms.
   *
   * @return
   * This just outputs the Full node ignoring the teaser mode.
   */
  function YOURTHEME_node_preview($variables)
  {
      $node = $variables['node'];
      $elements = node_view($node, 'full');
      $full = drupal_render($elements);
      $output = '&lt;div class="preview"&gt;';
      $output .= '&lt;h3 class="post-preview" &gt;' . t('Preview of your posting') . '&lt;/h3&gt;';
      $output .= $full;
      $output .= "&lt;/div&gt;\n";
      return $output;
  }


If that still doesn't look right you could try altering this code further to:


provide an override to node.tpl.php or node--preview.tpl.php using theme suggestions for drupal's theming layer functions.
alter the results of $full above using Regular Expressions to hack off the beginning and end of the HTML page content.