Hello,
I am getting this below error while i am trying to download pdf code.
Error - Invalid index: index should be in the range [1…n] where n equals to the pages count.
Used code -
<?php require_once DIR . '/vendor/autoload.php'; require_once DIR . '/Utils.php'; use Aspose\PDF\PdfApi; use Aspose\PDF\AsposeApp; class Text { public $pdfApi; public function __construct() { AsposeApp::$appSID = Utils::appSID; AsposeApp::$apiKey = Utils::apiKey; $this->pdfApi = new PdfApi(); } public function postDocumentReplaceTextList() { // Upload file to Aspose Cloud Storage $fileName = "Example.pdf"; Utils::uploadFile($fileName); $body = array('TextReplaces' => array(array('OldValue' => "05/30/2017", 'NewValue' => "09/07/2018", 'Regex' => true), array('OldValue' => "Cable ID", 'NewValue' => "Jayendra", 'Regex' => true))); $result = $this->pdfApi->PostDocumentReplaceTextList($fileName, $storage = "", $folder = "", $body); //echo ""; print_r ( $result ); die(); if(!empty($result)) { //$result = $this->pdfApi->GetTextItems($fileName, $withEmpty = "", $storage = "", $folder = ""); //echo ""; print_r ( $result ); die(); //$jsresp = $this->pdfApi->GetDocumentAttachments($fileName, $storage = "", $folder = ""); $jsresp = $this->pdfApi->GetDownloadDocumentAttachmentByIndex($fileName, 1, $storage = "", $folder = ""); echo ""; print_r($jsresp); }else { echo "not"; } } } $text = new Text(); $text->postDocumentReplaceTextList(); ?>