I am trying to save the DOCX file that is generated after hitting the PHP PDF to DOCX File. When I try to save it directly it is not getting opened and is throwing an error that probably the file is corrupted or cannot be read. Can you please help me with a solution to save the response in a DOCX file on my system without any errors? file_put_content is saving a DOCX file but the file is not getting opened.
This is the piece of my code.
$wordsApi= new WordsApi(‘xxxxxxx-xxxxxx’,‘xxxxxx-xxxxxx’);
$pdf = $filePath;
$request = new ConvertDocumentRequest(
$pdf, “docx”, NULL, NULL, NULL, NULL