A: 

The question isn’t very clear, but I assume you’re writing a web application, and you’re trying to serve up the PDF document to the client.

First, you need to set a header to let the client know that it should expect PDF data:

header('Content-type: application/pdf');

That will cause most browsers to render the PDF within the browser window. If you’d rather have the browser offer the PDF as a download, do this in addition to the above:

header('Content-Disposition: attachment; filename="filename.pdf"');

You may set any filename you like in place of filename.pdf.

It’s important that you make these calls to header() before any output is written.

As an aside, I guess that $d is a debug flag, but I don’t think it’s a very good idea to do those string operations that you’re doing when it’s set. You’re likely to end up corrupting the PDF data.

Daniel Cassidy
Thank you! Is this valid?$db_data = array( array('first'=> 'Customer Name:','second'=> $row_cust['cust_name']) ,array('first'=> 'Phone Number:','second'=> $row_cust['cust_phone']) ,array('first'=> 'Address:','second'=> $row_cust['cust_address']) ,array('first'=> 'Customer Ref/ Room Number:','second'=>$row_cust['cust_ref']) ); where Ex .($row_cust['cust_ref']) is data from the DB.
anonymous123