1. Go to this page and download the library: Download mrpix/cloudprintsdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mrpix / cloudprintsdk example snippets
use Mrpix\CloudPrintSDK\HttpClient\CloudPrintClient;
$client = new CloudPrintClient();
// Load credentials from config
$username = '[email protected]';
$password = 'yourSecretPassword';
$client = new CloudPrintClient($username, $password);
$instruction = new InsertTemplatePrintJobInstruction(
'Printername',
'Templatename',
[
'variable_key'=>'variable_value'
]
);
$request = $instruction->buildRequest();
try {
$client->send($request);
} catch (ServerException $e) {
// In case of an error
echo 'Error '.$e->getStatusCode().": ".$e->getMessage();
}
$instruction = new InsertDocumentPrintJobInstruction(
'Printername',
'This is the content of the document',
'nameOfTheFile.stm',
MediaTypes::TEXT_VND_STAR_MARKUP
);
$request = $instruction->buildRequest();
try {
$client->send($request);
} catch (ServerException $e) {
// In case of an error
echo 'Error '.$e->getStatusCode().": ".$e->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.