PHP code example of zafarjonovich / application-filler

1. Go to this page and download the library: Download zafarjonovich/application-filler 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/ */

    

zafarjonovich / application-filler example snippets




use zafarjonovich\ApplicationFiller\element\Font;
use zafarjonovich\ApplicationFiller\element\Group;
use zafarjonovich\ApplicationFiller\element\Groups;
use zafarjonovich\ApplicationFiller\element\Line;
use zafarjonovich\ApplicationFiller\element\Lines;
use zafarjonovich\ApplicationFiller\element\Point;
use zafarjonovich\ApplicationFiller\element\Text;
use zafarjonovich\ApplicationFiller\ApplicationFiller;

try {
    $groups = new Groups();

    $groups->add(
        new Group(
            new Text('x',new Font('ubuntu.ttf',18)),
            (new Lines())
                ->add(
                    new Line(new Point(493,127),new Point(510,127))
                )
        )
    );

    $groups->add(
        new Group(
            new Text('English, Russian, Uzbek',new Font('ubuntu.ttf',16)),
            (new Lines())
                ->add(
                    new Line(new Point(280,196),new Point(640,196))
                )
        )
    );

    $groups->add(
        new Group(
            new Text('x',new Font('ubuntu.ttf',18)),
            (new Lines())
                ->add(
                    new Line(new Point(548,265),new Point(650,265))
                )
        )
    );

    $groups->add(
        new Group(
            new Text('x',new Font('ubuntu.ttf',18)),
            (new Lines())
                ->add(
                    new Line(new Point(548,265),new Point(650,265))
                )
        )
    );

    $groups->add(
        new Group(
            new Text('x',new Font('ubuntu.ttf',18)),
            (new Lines())
                ->add(
                    new Line(new Point(548,335),new Point(650,335))
                )
        )
    );

    $groups->add(
        new Group(
            new Text('x',new Font('ubuntu.ttf',18)),
            (new Lines())
                ->add(
                    new Line(new Point(490,402),new Point(510,402))
                )
        )
    );

    $largeText = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";

    $groups->add(
        new Group(
            new Text($largeText,new Font('ubuntu.ttf',12)),
            (new Lines())
                ->add(
                    new Line(new Point(120,558),new Point(650,558))
                )
                ->add(
                    new Line(new Point(120,608),new Point(650,608))
                )
                ->add(
                    new Line(new Point(120,665),new Point(650,665))
                )
                ->add(
                    new Line(new Point(120,715),new Point(650,715))
                )
                ->add(
                    new Line(new Point(120,770),new Point(650,770))
                )
                ->add(
                    new Line(new Point(120,820),new Point(650,820))
                )
        )
    );

    $filler = new ApplicationFiller('application-form.jpg',$groups);

    $filler->draw();

    $filler->image->save('temp.jpg');

} catch (Exception $exception) {
    echo $exception->getMessage();
}



$text = new Text("Hello world !",new Font('ubuntu.ttf',12));
$text->setAlignment(Text::ALIGNMENT_MODE_CENTER);

$groups->add(
    new Group(
        $text,
        (new Lines())
            ->add(
                new Line(new Point(490,402),new Point(510,402))
            )
    )
);