[$name, $label]) { $top = 636 - $index * 170; array_push( $operators, new BeginTextObject(), new SetTextFontAndSize(new NameType('F1'), new NumericType(12)), new MoveTextPosition(new NumericType(42), new NumericType($top + 16)), new ShowText(new LiteralString($label)), new EndTextObject(), new SaveGraphicsState(), new ConcatenateMatrix(new Matrix(new NumericType(256), new NumericType(0), new NumericType(0), new NumericType(128), new NumericType(42), new NumericType($top - 128))), new InvokeXObject(new NameType($name)), new RestoreGraphicsState(), ); } $content = new StreamObject(new ContentStreams(...$operators)); $pages = new PageTreeNode(); $pages->addKid(new PageObject(new Rectangle(new NumericType(0), new NumericType(0), new NumericType(595), new NumericType(842)), $resources, $content)); $catalog = new DocumentCatalog($pages); $file = new FileStructure(new FileHeader('1.7'), new FileBody($catalog), new IndirectReference($catalog)); $path = $argv[1] ?? __DIR__ . '/filters-predictors.pdf'; $file->writeTo($path); echo $path . PHP_EOL;