So as the title suggests I am facing the issue where date formatting on pdfs from Word documents comes in the locale of the server which is “mm-dd-yyyy”." In contrast, I want it in a different format say “dd-mm-yyyy”.
I found likes on how to set this in the .net and java library but not for Aspose.Words Cloud SDK for PHP.
Below is how I currently use the library (using Laravel)
// Instantiate 3rd Party library
$wordsApi = new WordsApi(config('app.words_api_client_id'), config('app.words_api_client_secret'));
// Path to our document in Storage/app/public/documents/...
$documentPath = storage_path('app/public/documents') . DIRECTORY_SEPARATOR . $filename;
// Convert the document
$convertRequest = new ConvertDocumentRequest($documentPath, "pdf");
// Try to convert the document using the API else throw the error
try {
$response = $wordsApi->convertDocument($convertRequest);
} catch (\Throwable $th) {
throw $th;
}
// File::delete(storage_path('app/public/documents/') . $filename);
return file_get_contents($response->getPathName(), true);
I tried looking into the source code to see where the localisation is being set but it’s like looking for a needle in a hay stack.
Any guidance is greatly appreciated!