Tutorial 9 : Retrieve the generated document - neeftarah/odtphp GitHub Wiki
The purpose of this tutorial is to show two possible methods to retrieve the result of a process with odtPHP.
Open file directly from the client browser
<?php
$odf->exportAsAttachedFile();
The method exportAsAttachedFile()
allows you to send the result directly to the client browser.
Be careful, before calling this method, make sure that HTTP headers have not been already sent.
Save the file to the server
$odf->saveToDisk('fichier.odt');
?>
The method saveToDisk()
saves the result on the server. It takes as parameter a valid path to the file. Note that if you call saveToDisk()
without parameter, odtPHP will just perform an internal saving of the current document.