$line) { $operators[] = new Op\BeginTextObject(); $operators[] = new Op\SetTextFontAndSize(new NameType('F1'), new NumericType($index === 0 ? 20 : 11)); $operators[] = new Op\MoveTextPosition(new NumericType(48), new NumericType(780 - 30 * $index)); $operators[] = new Op\ShowText(new LiteralString($line)); $operators[] = new Op\EndTextObject(); } $operators = [...$operators, new Op\SaveGraphicsState(), new Op\BeginMarkedContentWithProperties(new NameType('Sample'), new NameType('ColourInfo')), new Op\SetGraphicsStateParameters(new NameType('BpcOn')), new Op\SetNonstrokingColorSpace(new NameType('Calibrated')), new Op\SetNonstrokingColor(new NumericType(0.1), new NumericType(0.3), new NumericType(0.6)), new Op\AppendRectangle(new NumericType(48), new NumericType(440), new NumericType(496), new NumericType(100)), new Op\FillPathNonzero(), new Op\EndMarkedContent(), new Op\RestoreGraphicsState()]; $page = new PageObject(new Rectangle(new NumericType(0), new NumericType(0), new NumericType(595), new NumericType(842)), $resources, new StreamObject(new ContentStreams(...$operators), filters: new FlateDecode()), new Parts\DocumentPartEntry($part)); $pages = (new PageTreeNode())->addKid($page); $part->setPageRange($page); $catalog = new DocumentCatalog($pages, new Metadata\MetadataEntry($documentMetadata), $partRoot->catalogEntry(), new Files\AssociatedFilesEntry($associated), new Entry(new NameType('Names'), new DictionaryType($attachments->nameDictionaryEntry()))); $output = $argv[1] ?? __DIR__ . '/pdf20-metadata-declarations.pdf'; (new FileStructure(new FileHeader('2.0'), new FileBody($catalog)))->writeTo($output); echo $output . PHP_EOL;