Convert PDF to DOCX File Without Adobe in PHP Throws Timeout Error

I have a large file that I am trying to convert from pdf to word, but multiple tries have always resulted in the error below. It has been successful with smaller files. The size of this particular pdf is 72.7 MB. I am using the PHP SDK.
An uncaught Exception was encountered

Type: Aspose\PDF\ApiException
Message: [504] Server error: PUT https://api.aspose.cloud/v3.0/pdf/Large.pdf/convert/doc?outPath=Large.docx&format=DocX&storage=docx resulted in a 504 Gateway Time-out response

@macrouser

I am unable to notice any issue when trying to convert a sample large PDF to a DOCX file in PHP with Aspose.PDF REST API. We will appreciate it if you please share your sample input document via some file sharing service. We need to replicate the issue at our end for investigation.

How to Convert PDF to DOCX in PHP

  • Create a free account with aspose.cloud for credentials

  • Install Aspose.PDF Cloud SDK for PHP via Composer

  • Create a PHP Script File and add reference to Aspose.PDF REST API

  • Initialize Aspose.PDF REST API

  • Upload input PDF file to Cloud storage using ‘uploadFile’ API method

  • Call putPdfInStorageToDoc API method to convert PDF to DOCX file

Code to Convert PDF to DOCX in PHP Online without Adobe

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

use Aspose\PDF\Api\PdfApi;
use Aspose\PDF\Configuration;

// Get Client ID and Secret from https://www.aspose.cloud
$cliedId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx';
$clientSecret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';

$config = new Configuration();
$config->setAppKey($clientSecret);
$config->setAppSid($cliedId);

// Initialize the API
$pdfApi = new PdfApi(null, $config);

// Upload file to cloud storage
$localFile = "02_pages.pdf";
$name = "02_pages.pdf";
$pdfApi->uploadFile($localFile, $name);

// Convert PDF to DOCX
$resFileName = "result.doc";        
$outFormat = "DocX";
$response = $this->pdfApi->putPdfInStorageToDoc($name, $resFileName, $outFormat, null, null, null, null, null, null, null, null);
echo $response

?>

I created a public bucket on s3. Here is a link to the file https://ssc-public-test.s3.us-west-1.amazonaws.com/Large.pdf Let me know if that doesn’t work.

@macrouser

Thanks for sharing the input document. We have reproduced the issue and logged a ticket PDFCLOUD-2212 for further investigation. We will notify you as soon the issue is resolved.