Last active
June 14, 2018 06:10
-
-
Save aspose-cloud/13c935436d7277d8670199004bcf6521 to your computer and use it in GitHub Desktop.
The GIST contains PHP Examples of Aspose.PDF Cloud APIs.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The GIST contains PHP Examples of Aspose.PDF Cloud APIs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-php | |
<?php | |
require_once realpath(__DIR__ . '/..') . '/vendor/autoload.php'; | |
use Aspose\PDF\Api\PdfApi; | |
use Aspose\PDF\Configuration; | |
class Text { | |
protected $pdfApi; | |
protected $config; | |
public function __construct() { | |
// Get App key and App SID from https://cloud.aspose.com | |
$appSid = 'xxxxxxxxxx'; | |
$appKey = 'xxxxxxxxxx'; | |
$host = 'https://api.aspose.cloud/v1.1'; | |
$this->config = new Configuration(); | |
$this->config->setAppKey($appKey); | |
$this->config->setAppSid($appSid); | |
$this->config->setHost($host); | |
$this->pdfApi = new PdfApi(null, $this->config); | |
} | |
private function uploadFile($fileName, $subFolder = null) { | |
$file = realpath(__DIR__ . '/..') . '/Data/' . $fileName; | |
$result = $this->pdfApi->PutCreate($Path=$fileName, $file); | |
} | |
public function postDocumentReplaceText() { | |
$name = 'Sample.pdf'; | |
$this->uploadFile($name); | |
$textReplaceRequest = new Aspose\PDF\Model\TextReplaceRequest(); | |
$textReplaceRequest->setOldValue('brown'); | |
$textReplaceRequest->setNewValue('b_r_o_w_n'); | |
$textReplaceRequest->setRegex(false); | |
$response = $this->pdfApi->postDocumentReplaceText($name, $textReplaceRequest, $storage = null, $folder = null); | |
} | |
} | |
$text = new Text(); | |
$text->postDocumentReplaceText(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment