Skip to content

Instantly share code, notes, and snippets.

@jonathanmaron
Created October 23, 2018 10:20
Show Gist options
  • Save jonathanmaron/be31450d566d16911e6d9276d72e520d to your computer and use it in GitHub Desktop.
Save jonathanmaron/be31450d566d16911e6d9276d72e520d to your computer and use it in GitHub Desktop.
<?php
use TxTextControl\ReportingCloud\Console\Helper;
use TxTextControl\ReportingCloud\ReportingCloud;
$reportingCloud = new ReportingCloud([
'api_key' => Helper::apiKey(),
]);
$documents = [
[
'filename' => REPORTING_CLOUD_DEMO_MEDIA_PATH . '/test_document.docx',
'divider' => ReportingCloud::DOCUMENT_DIVIDER_NEW_SECTION,
],
[
'filename' => REPORTING_CLOUD_DEMO_MEDIA_PATH . '/test_document.docx',
'divider' => ReportingCloud::DOCUMENT_DIVIDER_NEW_SECTION,
],
[
'filename' => REPORTING_CLOUD_DEMO_MEDIA_PATH . '/test_document.docx',
'divider' => ReportingCloud::DOCUMENT_DIVIDER_NEW_SECTION,
],
];
$destinationFilename = REPORTING_CLOUD_DEMO_OUTPUT_PATH . '/test_append_document_advanced.pdf';
$documentSettings = [
'author' => 'James Henry Trotter',
'creation_date' => time(),
'creator_application' => 'An awesome creator',
'document_subject' => 'The Old Green Grasshopper',
'document_title' => 'James and the Giant Peach',
'last_modification_date' => time(),
'user_password' => '1',
];
$binaryData = $reportingCloud->appendDocument($documents, 'PDF', $documentSettings);
file_put_contents($destinationFilename, $binaryData);
var_dump($destinationFilename);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment