-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo.php
30 lines (22 loc) · 1.1 KB
/
demo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
use Kduma\PdfImposition\LayoutGenerators\Markers\HeadersMarkings;
use Kduma\PdfImposition\LayoutGenerators\Markers\PrinterBoxCutMarkings;
use Kduma\PdfImposition\LayoutGenerators\AutoGridPageLayoutGenerator;
use Kduma\PdfImposition\DTO\PageMargins;
use Kduma\PdfImposition\DTO\PageSize;
use Kduma\PdfImposition\PdfImposer;
use Kduma\PdfImposition\PdfSource;
use Kduma\PdfImposition\DTO\Size;
require __DIR__.'/vendor/autoload.php';
$cardSize = Size::make(90, 50);
$pageSize = PageSize::fromName('A4');
$pageMargins = PageMargins::make();
$cut_every_pages = 5;
$layoutGenerator = new AutoGridPageLayoutGenerator($cardSize, 0, 0, $pageSize, $pageMargins);
$layoutGenerator->center();
$layoutGenerator = new PrinterBoxCutMarkings($layoutGenerator);
$layoutGenerator->setPrintEvery($cut_every_pages);
$layoutGenerator = new HeadersMarkings($layoutGenerator, 'Page {PAGENO}, Sheet {SHEET}');
$PdfImposer = new PdfImposer($layoutGenerator);
$cards = (new PdfSource)->readAsCutStacks(__DIR__ . '/tests/test_input.pdf', $layoutGenerator->getBoxesCount(), $cut_every_pages, true);
$PdfImposer->export($cards, 'output.pdf');