Last active
September 10, 2023 05:03
-
-
Save jonathanmaron/50d5066739229c7ada75841fa542072c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
declare(strict_types=1); | |
include_once __DIR__ . '/vendor/autoload.php'; | |
use TextControl\ReportingCloud\ReportingCloud; | |
use TextControl\ReportingCloud\Stdlib\ConsoleUtils; | |
use TextControl\ReportingCloud\Stdlib\Path; | |
$reportingCloud = new ReportingCloud([ | |
'api_key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
]); | |
$sourceFilename = sprintf('%s/test_template.docx', Path::resource()); | |
$destinationFilename = 'test_template_merged.pdf'; | |
$mergeData = [ | |
'name' => 'Jemima Puddle-Duck', | |
'age' => 7, | |
]; | |
$arrayOfBinaryData = $reportingCloud->mergeDocument( | |
$mergeData, | |
ReportingCloud::FILE_FORMAT_PDF, | |
null, | |
$sourceFilename | |
); | |
file_put_contents($destinationFilename, $arrayOfBinaryData[0]); | |
ConsoleUtils::writeLn('Written to "%s".', [$destinationFilename]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment