Skip to content

Instantly share code, notes, and snippets.

@jonathanmaron
Last active October 23, 2018 10:32
Show Gist options
  • Save jonathanmaron/ce2b5769e2ab00fc76e4efb8dd1fdb34 to your computer and use it in GitHub Desktop.
Save jonathanmaron/ce2b5769e2ab00fc76e4efb8dd1fdb34 to your computer and use it in GitHub Desktop.
<?php
use TxTextControl\ReportingCloud\ReportingCloud;
$reportingCloud = new ReportingCloud([
'api_key' => Helper::apiKey(),
]);
$templateName = 'sample_invoice.tx';
$arrayOfBinaryData = $reportingCloud->getTemplateThumbnails('sample_invoice.tx', 100, 1, 1, 'PNG');
foreach ($arrayOfBinaryData as $index => $binaryData) {
$destinationFile = sprintf('sample_invoice_p%d.png', $index);
$destinationFilename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . $destinationFile;
file_put_contents($destinationFilename, $binaryData);
var_dump("{$templateName} was written to {$destinationFilename}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment