file_save_data() cannot save to private://
Check two things:


The private flesystem is configured: look in
/admin/config/media/file-system.
The destination directory (private://pdf) is created. The exact path
of private:// depends on where have tou configured the private
filesystem.