awakenweb / livedocx

Livedocx webservice PHP API for PDF generation without using Zend Framework

Home Page:http://awakenweb.github.io/livedocx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a DocumentBuilder class

awakenweb opened this issue · comments

Add a DocumentBuilder class to create documents with a fluent style

...

$docbuilder= new Awakenweb\Livedocx\DocumentBuilder($soapClient);

$docbuilder->createNewPdfDocument('myResume.pdf')
           ->fromRemoteTemplate('ResumeTemplate.docx')
           ->withImages([
               'photo' => '/home/John/images/my-face.jpg',
               ...
           ])
           ->withBlocks([
               'scholarship' => [
                   ['school' => 'MIT', 'year' => '2010' ],
                   ['school' => 'Berkley', 'year' => '2009'],
                   ...
               ],
               'previous jobs' => [
                   ...
               ]
           ])
           ->withValues([
               'first_name' => 'John',
               'last_name' => 'Doe',
               'birth_date' => '12-29-1981',
               'city'          => 'New York',
               ...
           ])
           ->generate()
           ->save('/path/to/the/folder/you/want');