How to Retrieve Information about PDF Document Pages

I want to integrate your service for my client’s work but I am facing some problem knocking many times on your skype no response.

After everything is fine it gives “Can’t find file located at” error


This Topic is created by tilal.ahmad using Email to Topic tool.

@abdurrahimctg10

Please note GetInfo API method processes files from cloud storage, so please first upload your source file to cloud storage and set the file path to it. Please check the following documentation link for sample PHP code to upload a file to cloud storage.

@tilal.ahmad
Screenshot_4.png (49.0 KB)
Even after I uploaded it to the live server it didn’t work. I have given all the information below
This is the project directory: https://joydevs.com/work/
file url : https://joydevs.com/work/bigpage.pdf
Screenshot_6.png (115.3 KB)

this project source code: https://drive.google.com/file/d/1U8oX2eQpR6lWJnpjyoU6jHNNpyuEm5hB/view?usp=sharing

Please let me know why the problem is happening, it will be very helpful

Our main target is to find out how many pages a document has (Get Document Information | GroupDocs.Viewer Cloud | Documentation)

@fdgfdgdfg

Please note that you need to pass the cloud storage file path to fileinfo parameter instead of your local(project) file path. Please check the following sample code to upload a local file to the cloud storage and get the page count of a document; you can amend it as per your requirements. Hopefully, it will help you accomplish the task.

<?php

require_once('D:\xampp\htdocs\groupdocs-viewer-cloud-php-master\vendor\autoload.php');
//require_once(__DIR__ . '/vendor/autoload.php');

//Get Client Id and Client Secret from https://dashboard.groupdocs.cloud
$myClientId = "xxxxx-xxxx-xxxx-xxxx-xxxxxxxx";
$myClientSecret = "xxxxxxxxxxxxxxxxxxxxxxxxx";

// Create instance of the API
$configuration = new GroupDocs\Viewer\Configuration();
$configuration->setAppSid($myClientId);
$configuration->setAppKey($myClientSecret);

$infoApi = new GroupDocs\Viewer\InfoApi($configuration); 
$fileApi = new GroupDocs\Viewer\FileApi($configuration);

try {
	//Upload local file to cloud storage
	$localfile = 'data/4pages.pdf';
	$remotefile = 'Temp/4pages.pdf';

	$uploadrequest = new GroupDocs\Viewer\Model\Requests\UploadFileRequest($remotefile,$localfile);
	$uploadresponse = $fileApi->uploadFile($uploadrequest);
	
	// Get Document Info
	$viewOptions = new GroupDocs\Viewer\Model\ViewOptions();
	$fileInfo = new GroupDocs\Viewer\Model\FileInfo();
	$fileInfo->setFilePath($remotefile);
	$viewOptions->setFileInfo($fileInfo);
	$request = new GroupDocs\Viewer\Model\Requests\GetInfoRequest($viewOptions);
	$response = $infoApi->getInfo($request);
	echo 'page count of the document - ' . count($response->getpages());

} catch (Exception $e) {
	echo  "Something went wrong: ",  $e->getMessage(), "\n";
    	PHP_EOL;
}

?>