$fp = fopen("DIR/".$user_id or $order_nbr.".pdf", "w");
$pdf = PDF_open($fp);
PDF_begin_page($pdf, 595, 842);
PDF_add_outline($pdf, "Page 1");
...
The rest you probably know, right?
Then start your mail class and attache the filename to the mail...
filename = $user_id or $order_nbr.pdf ...
And that's it.
Hope that helped,
Kind regards,
Gerry