Done templating

This commit is contained in:
pandeptwidyaop
2024-08-15 07:42:05 +08:00
commit 4e7639359d
23 changed files with 1743 additions and 0 deletions

35
src/Command/Generate.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
namespace MenulisAi\Pdfgen\Command;
use MenulisAi\Pdfgen\Document\Ebook;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Generate extends Command
{
protected static $defaultName = "generate";
protected function configure()
{
$this->setDescription('Generate a PDF document file from JSON data')
->addArgument("input", InputArgument::REQUIRED, "Input path file JSON")
->addArgument("output", InputArgument::OPTIONAL, "Set the output path");
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$inPath = $input->getArgument("input");
$output->writeln(rootPath($inPath));
$doc = new Ebook($inPath);
$path = $doc->compile();
// $output->writeln($path);
return Command::SUCCESS;
}
}