<?php //////////////////////////////////////////////////////////////////////////////// // __________ __ ________ __________ // \______ \ |__ ______ / _____/ ____ _____ ______\______ \ _______ ___ // | ___/ | \\____ \/ \ ____/ __ \\__ \\_ __ \ | _// _ \ \/ / // | | | Y \ |_> > \_\ \ ___/ / __ \| | \/ | ( <_> > < // |____| |___| / __/ \______ /\___ >____ /__| |______ /\____/__/\_ \ // \/|__| \/ \/ \/ \/ \/ // ----------------------------------------------------------------------------- // Designed and Developed by Brad Jones <brad @="bjc.id.au" /> // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// require '../../vendor/autoload.php'; $doc = new Gears\Pdf('../templates/Convert.docx'); $doc->download(); /* * NOTE: The trick I have found to get Unoconv to work with apache it to start * a listener via the command line first. For example: * * ``` * unoconv --listener & * ``` * * So on your server you just need to make sure this is started on boot. * Maybe i'll get around to writing a init script for it... */
public function testCloneRow() { $document = new Gears\Pdf('./tests/templates/CloneRow.docx'); $document->converter = $this->converter; $document->cloneRow('rowValue', 10); $document->setValue('rowValue_1', 'Sun'); $document->setValue('rowValue_2', 'Mercury'); $document->setValue('rowValue_3', 'Venus'); $document->setValue('rowValue_4', 'Earth'); $document->setValue('rowValue_5', 'Mars'); $document->setValue('rowValue_6', 'Jupiter'); $document->setValue('rowValue_7', 'Saturn'); $document->setValue('rowValue_8', 'Uranus'); $document->setValue('rowValue_9', 'Neptun'); $document->setValue('rowValue_10', 'Pluto'); $document->setValue('rowNumber_1', '1'); $document->setValue('rowNumber_2', '2'); $document->setValue('rowNumber_3', '3'); $document->setValue('rowNumber_4', '4'); $document->setValue('rowNumber_5', '5'); $document->setValue('rowNumber_6', '6'); $document->setValue('rowNumber_7', '7'); $document->setValue('rowNumber_8', '8'); $document->setValue('rowNumber_9', '9'); $document->setValue('rowNumber_10', '10'); $document->cloneRow('userId', 3); $document->setValue('userId_1', '1'); $document->setValue('userFirstName_1', 'James'); $document->setValue('userName_1', 'Taylor'); $document->setValue('userPhone_1', '+1 428 889 773'); $document->setValue('userId_2', '2'); $document->setValue('userFirstName_2', 'Robert'); $document->setValue('userName_2', 'Bell'); $document->setValue('userPhone_2', '+1 428 889 774'); $document->setValue('userId_3', '3'); $document->setValue('userFirstName_3', 'Michael'); $document->setValue('userName_3', 'Ray'); $document->setValue('userPhone_3', '+1 428 889 775'); $document->save('./tests/output/UnoconvoCloneRow.pdf'); $text = Str::s($this->pdfBox->textFromPdfFile('./tests/output/UnoconvoCloneRow.pdf'))->to('ascii'); $this->assertTrue($text->contains('Value 1: Sun')); $this->assertTrue($text->contains('Value 2: Mercury')); $this->assertTrue($text->contains('Value 3: Venus')); $this->assertTrue($text->contains('Value 4: Earth')); $this->assertTrue($text->contains('Value 5: Mars')); $this->assertTrue($text->contains('Value 6: Jupiter')); $this->assertTrue($text->contains('Value 7: Saturn')); $this->assertTrue($text->contains('Value 8: Uranus')); $this->assertTrue($text->contains('Value 9: Neptun')); $this->assertTrue($text->contains('Value 10: Pluto')); $this->assertTrue($text->contains("1 Name TaylorFirst name JamesPhone +1 428 889 773")); $this->assertTrue($text->contains("2 Name BellFirst name RobertPhone +1 428 889 774")); $this->assertTrue($text->contains("3 Name RayFirst name MichaelPhone +1 428 889 775")); }
public function testConvert() { $html = file_get_contents('./tests/templates/PhantomJs.html'); $result = Gears\Pdf::convert($html, './tests/output/PhantomJsConvert.pdf'); $this->assertInstanceOf('SplFileInfo', $result); $this->assertFileExists('./tests/output/PhantomJsConvert.pdf'); $text = Str::s($this->pdfBox->textFromPdfFile('./tests/output/PhantomJsConvert.pdf'))->to('ascii'); $this->assertTrue($text->contains('Iamthecoverpage.')); $this->assertTrue($text->contains('B15/15')); }
<?php //////////////////////////////////////////////////////////////////////////////// // __________ __ ________ __________ // \______ \ |__ ______ / _____/ ____ _____ ______\______ \ _______ ___ // | ___/ | \\____ \/ \ ____/ __ \\__ \\_ __ \ | _// _ \ \/ / // | | | Y \ |_> > \_\ \ ___/ / __ \| | \/ | ( <_> > < // |____| |___| / __/ \______ /\___ >____ /__| |______ /\____/__/\_ \ // \/|__| \/ \/ \/ \/ \/ // ----------------------------------------------------------------------------- // Designed and Developed by Brad Jones <brad @="bjc.id.au" /> // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// require '../../vendor/autoload.php'; $doc = new Gears\Pdf('../templates/action-plan-template.docx'); $doc->stream(); /* * NOTE: The trick I have found to get Unoconv to work with apache it to start * a listener via the command line first. For example: * * ``` * unoconv --listener & * ``` * * So on your server you just need to make sure this is started on boot. * Maybe i'll get around to writing a init script for it... */