Creating Multiple-Page PDFs
Two last aspects of PDF creation I would like to discuss are creating multiple page documents and saving the created PDF to the server.
Creating multiple pages is far easier than one might think. All it requires is that the one page is concluded with pdf_end_page() and that another is immediately begun with pdf_begin_page(). You will need to re-establish some settings, like the font to use, with each new page, though.
To save a file to the server, give the pdf_open_file() function a filename.
pdf_open_file ($pdf, 'my_file.pdf');
This will make PHP try to create (or open, if it exists) a PDF called my_file.pdf within the current directory. This does require open read-write permissions (666) on the directory to work. ...