Creating output files from Drupal 6 I need to produce PDF/HTML output from my Drupal 6 app; is there a "Drupal way" to create a template with variables and then substitute them when the output is rendered or do i have to realize it by hand?

EDITED

Data is not on a node, but need to select from a non-drupal table
If you're using Views, you could try the Views PDF module.


  With this module you can output a view as a PDF document. Each field
  of the view can be placed on the PDF page directly in the
  administration interface. Therefore a new display called "PDF" is
  added.


Or perhaps the Print module if you're just creating a PDF from a node.


  This module allows you to generate the following printer-friendly
  versions of any node:
  
  
  Printer-friendly version (webpage format) (at
  www.example.com/print/nid) 
  PDF version (at
  www.example.com/printpdf/nid) 
  Send by email (at
  www.example.com/printmail/nid)
  


Edit:

If you're willing to do a little legwork, you can use the Data module to expose your non-Drupal table to Views, and then use the previously mentions Views PDF