TCPDF Save file to folder?

To save a file generated by TCPDF to a specific folder, you can use the TCPDF "Output" function. The function takes two parameters: the name of the file, and the destination where the file should be saved.

For example, to save a file named "example.pdf" to a folder named "pdfs", you would use the following code:

$pdf->Output('pdfs/example.pdf', 'F');

The second parameter ('F') tells TCPDF to save the file to a local server folder. Other options include 'I' for inline (displayed in the browser), 'D' for download, and 'S' for returning the document as a string.

Watch a course Learn object oriented PHP

It's also important to note that the folder where you want to save the PDF file should have the correct permissions to be written to.