Replace Text in a PDF File (PHP SDK)

Skip to end of metadata
Go to start of metadata
This example allows you to replace text in a PDF file using the Saaspose Pdf PHP SDK.
	    $pdfFile = getcwd() . "\\Input\\ReplaceText.pdf";
	    $fileName = basename($pdfFile);

            //set application information
	    SaasposeApp::$AppSID = "77**************";
	    SaasposeApp::$AppKey = "89***********";
	    
	    //specify product URI and output location
	    Product::$BaseProductUri = "http://api.saaspose.com/v1.0";
	    SaasposeApp::$OutPutLocation = getcwd() . "/Output/";
	    $folderPath = "";
	    
    	    echo "Uploading pdf file...<br />";
	    //upload input file
	    $folder = new Folder();
	    $folder->UploadFile($pdfFile , $folderPath);
	    echo "pdf file uploaded <br />";

	    echo "Replacing text in PDF file... <br />";
	    //create TextEditor object
	    $pdfTextEditor = new TextEditor($fileName);
	    //Replace text in Pdf file
	    $pdfTextEditor->ReplaceText("oldText", "newText", false);

	    echo "Text has been replaced successfully";

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.