pdf to html conversion not providing appropriate result. Please see the attached snapshot and below is code of conversions.
Hi Waheed,
Thanks for contacting support.
First of all, it is not clear from your code what values you have set and what values you are passing. If you are using PHP SDK, please use the following example as specified on Convert PDF to other formats without using storage:
Using PHP SDK
use Aspose\Cloud\Common\AsposeApp;
use Aspose\Cloud\Common\Utils;
use Aspose\Cloud\Common\Product;
use Aspose\Cloud\Pdf\Converter;
AsposeApp::$appSID = "77******-1***-4***-a***-8***********" //App SID
AsposeApp::$appKey = "89*****************************" //App Key
Product::$baseProductUri = "http://api.aspose.com/v1.1";
AsposeApp::$outPutLocation = getcwd() . "/Output/";
echo "Converting PDF to TIFF... ";
$converter = new Converter("");
$converter->convertLocalFile(
getcwd() . "/Input/input.pdf",
"Output.zip",
html
);
echo "done";
Please note that when converting PDF to HTML, Aspose for Cloud returns the output file as a ZIP, not as HTML. So if you are passing correct values and doing everything right, even then you should handle the output file as a ZIP, not as HTML. The convertLocalFile(..)
method takes the first argument as the input file, the second argument as the output file, and the third argument as the output format. You may consider using the following code to extract HTML from the .zip file (on a Windows platform):
Extracting HTML from ZIP (Windows):
Utils::saveFile($responseStream, $outputPath);
$zip = new ZipArchive;
$zip->open($outputPath);
$zip->extractTo(getcwd() . '/Output/OutputHtml');
$zip->close();
echo "File converted";
For the Linux code, see this link.
Besides this, if your requirement is to convert a PDF file to HTML so that it can be displayed/rendered inside a web browser, I would suggest trying the ViewerApp of our sister company, GroupDocs, which can be used to display various file formats in cloud applications.