We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

Convert DOCX to PDF in PHP Laravel Without Losing Format Using Aspose.Words REST API

Hello,

we are evaluating Aspose.words Cloud API for converting Microsoft Word documents, as part of a more complex application we developed for one of our customers (in Laravel PHP).

We tested your API and the result seems good.

But we received a weird question from the Customer: they want to know if the PDF generated through the API will be identical to a PDF generated by exporting manually the same file by Microsoft Word export function. If not, what is the level of similarity between the two PDF files?

Is there an answer to this question?

Thank you.

@isigillo

Yes, we try to mimic Microsoft Word as closest as possible in the Aspose.Words. So you can use Aspose.Words Cloud SDK for PHP to convert DOCX to PDF in PHP Laravel without any issue. However, please let us know if you find any issues in this regard.

PHP Convert DOCX to PHP Online

<?php

require_once('D:\xampp\htdocs\aspose-words-cloud-php-master\vendor\autoload.php');


try {

	//TODO: Get your ClientID and ClientSecret at https://dashboard.aspose.cloud (free registration is required).		
	$ClientSecret="xxxxxxxxxxxxxxxxxxxxx";
	$ClientId="xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxx";



	$wordsApi = new Aspose\Words\WordsApi($ClientId,$ClientSecret);	
	
    $format = "pdf";
    $file = ("C:/Temp/02_pages.docx");
    
	$request = new Aspose\Words\Model\Requests\ConvertDocumentRequest($file, $format,null);
    $result = $wordsApi->ConvertDocument($request);	
	copy($result->getPathName(),"02_pages.pdf");
	print_r($result->getPathName());
        
} catch (Exception $e) {
    echo  "Something went wrong: ",  $e->getMessage(), "\n";
    PHP_EOL;
}

?>
1 Like