addSection(); //Write utf-8 encoded text. //Text is from file. But you can use another resouce: db, sockets and other $sect->writeText(file_get_contents($dir . '/sources/utf8.txt'), $times12, null); // save rft document $rtf->save($dir . '/generated/' . basename(__FILE__, '.php') . '.rtf');