hi, you've to include the full path of your generated pdf. I don't think the PDF is generated in the root folder of the module. (except if you've changed the right after installation...) if it's the case you can use something like $loc = $CFG->dirroot . '/mod/mymoddirectorythatgeneratepdf/myfile.pdf'; But to use the moodle data folder use this variable $CFG->dataroot It's better to create a moodle data subfolder with the name of your module directory to save your pdf and give the rights. Hope it's helped. Dominique.