PHP code example of spacetab-io / gotenberg-sdk
1. Go to this page and download the library: Download spacetab-io/gotenberg-sdk 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/ */
spacetab-io / gotenberg-sdk example snippets
use Amp\Loop;
use Spacetab\Logger\Logger;
use Psr\Log\LogLevel;
use Spacetab\Sdk\Gotenberg;
use Spacetab\Sdk\Gotenberg\Request;
tp://0.0.0.0:3000');
$gotenberg->setLogger($logger);
$option = new Request\Html();
$option->setLandscape(true);
$option->setMarginBottom(0.1);
$option->setMarginLeft(0.1);
$option->setMarginRight(0.1);
$option->setMarginTop(0.1);
$option->setScale(0.70);
/** @var \Spacetab\Sdk\Gotenberg\Output $output */
$output = yield $gotenberg->html()->fromString('<p>hi</p>', $option);
yield $output->asFile(__DIR__ . '/index.pdf');
});