phpconf taiwan-2012
TRANSCRIPT
![Page 1: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/1.jpg)
Template-Based DOCX, DOC & PDF Generationwith Zend Framework 2.
@JonathanMaronE-Mail or Google+.
PHPConf Taiwan 2012November 03, 2012 at 10:10.
![Page 2: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/2.jpg)
About Jonathan Maron
Head of Web Development and Operations. I work for a software and hardware
manufacturer in Taipei, Germany and USA. We manufacture digital cameras for
industrial, scientific and medical applications. We author desktop and server software
components.
http://www.theimagingsource.comhttp://www.textcontrol.com
![Page 3: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/3.jpg)
New approach to generating DOCX, DOC, PDF etc. files
with Zend Framework 2.
![Page 4: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/4.jpg)
Creating PDFs with PHP
HTML-to-PDFapproach:
domPDF. HtmlToPdf. HTML_ToPDF. wkhtmltopdf. etc.
Programmaticapproach:
Zend_Pdf. PDFlib. FPDF. Cpdf. etc.
![Page 5: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/5.jpg)
Ralf Eggert quote
“I personally consider the current version [of
Zend_Pdf] to be limited in scope. It is extremely
difficult, if not impossible, to achieve usable
results. At the moment, developers, including myself, are looking for
alternatives [...]”PHP MagazinFebruary 2011 – March 2011, Ralf Eggert.
![Page 6: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/6.jpg)
The template approach.
![Page 7: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/7.jpg)
LiveDocx and Zend Framework 2
LiveDocx is a SOAP-based document generation service.
ZendService_LiveDocx (New BSD license): PHP 5.3 implementation of LiveDocx. Easy-to-use PHP API to rich SOAP service. Native component of the Zend Framework 2.
PHP 5 SoapClient and NuSOAP supported. All languages with SOAP are supported.
![Page 8: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/8.jpg)
Sounds interesting.
But how does it work?
![Page 9: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/9.jpg)
3 steps of document generation
STEP 1: In a word processor, create a template containing merge-fields.
STEP 2: Populate merge-fields in PHP.
STEP 3: Write generated document* to disk.
* DOCX, DOC, HTML, RTF, PDF, TXT
![Page 10: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/10.jpg)
Document generation process (1)
Data
LiveDocx
Document
Template + Data = Document.
Template
![Page 11: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/11.jpg)
![Page 12: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/12.jpg)
Step 1: Creating a template (2)
![Page 13: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/13.jpg)
Steps 2 & 3: Assign data & create doc
![Page 14: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/14.jpg)
![Page 15: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/15.jpg)
Multiple output formats, one API
![Page 16: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/16.jpg)
Sample 2:
Merging complex data structures.
![Page 17: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/17.jpg)
![Page 18: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/18.jpg)
Repeating blocks (loops)
![Page 19: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/19.jpg)
![Page 20: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/20.jpg)
Sample 3:
Merging image data.
![Page 21: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/21.jpg)
Merging image data
![Page 22: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/22.jpg)
![Page 23: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/23.jpg)
Sample 4:
Exporting to one ormore image files.
![Page 24: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/24.jpg)
Exporting to image files
![Page 25: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/25.jpg)
Multiple output formats, one API
![Page 26: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/26.jpg)
Working with templates:Local vs. remote.
![Page 27: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/27.jpg)
Using local templates
Specify template in every request.
![Page 28: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/28.jpg)
Using remote templates
Upload template once.
Reference template in all subsequent requests.
![Page 29: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/29.jpg)
Supported file formats.
![Page 30: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/30.jpg)
Supported template formats (input)
DOCX - Office Open XML format. DOC - Microsoft Word DOC format. RTF - Rich text format. TXD - TX Text Control format.
![Page 31: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/31.jpg)
Supported document formats (output)
DOCX - Office Open XML format. DOC - Microsoft Word DOC format. HTML - XHTML 1.0 transitional format. RTF - Rich text format. PDF - Acrobat portable document format. TXD - TX Text Control format. TXT - ANSI plain text.
![Page 32: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/32.jpg)
Supported image export formats
Documents can also be exported to images: BMP - Bitmap image file format. GIF - Graphics interchange format. JPG - Joint photographic experts group format. PNG - Portable network graphics format. TIFF - Tagged image file format.
![Page 33: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/33.jpg)
Supported image import formats
Images can be imported from: BMP - Bitmap image file format. GIF - Graphics interchange format. JPG - Joint photographic experts group format. PNG - Portable network graphics format. TIFF - Tagged image file format. WMF - Windows meta file format.
![Page 34: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/34.jpg)
Case study:
PHP Unconferences.
![Page 35: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/35.jpg)
PHP Unconferences
Well established unconferences about PHP. PHP Unconference Europe (Manchester, UK):
1st year: 100 attendees in February 2011.
PHP Unconference Hamburg (Germany):
6th year: 320 attendees in August 2012.
LiveDocx was used to create: Attendee badges (approx. 450 units). Vote posters (approx. 100 units).
![Page 36: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/36.jpg)
![Page 37: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/37.jpg)
![Page 38: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/38.jpg)
![Page 39: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/39.jpg)
![Page 40: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/40.jpg)
Live demonstrations
SAMPLE 1: license-agreement
SAMPLE 2: telephone-bill
SAMPLE 3: conference-pass
SAMPLE 4: bitmaps
![Page 41: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/41.jpg)
Get involved! Try it out yourself!
ZendService_LiveDocx Web Site.http://www.phplivedocx.org and http://goo.gl/oXUcf
Download Demo VMware Virtual Machinehttp://goo.gl/3aAGb (great way to get started)
ZendService_LiveDocx Source and Demos.https://github.com/jonathanmaron/ZendService_LiveDocx
LiveDocx Web Site and Blog.http://www.livedocx.com
Sign up for a LiveDocx account.https://www.livedocx.com/user/account_registration.aspx
![Page 42: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/42.jpg)
Full-time web developer wanted!
You love PHP, Zend Framework, HTMLand Javascript.
You want to develop web applications with an international team of specialists in Germany and Taiwan.
You want to work at our Taipei office(Song-Shan District 10555, Taipei City).
Interested? Talk to me!
![Page 43: Phpconf taiwan-2012](https://reader034.vdocuments.us/reader034/viewer/2022052301/55510c13b4c9057b478b561b/html5/thumbnails/43.jpg)
Public / Hosted / Cloud
LiveDocx Free is available for all to use.Documentation and registration at www.livedocx.com.
LiveDocx Premium hosted service is available.TWD 1,140.00 per month.
Cloud-based solutions in the pipeline.AWS EC2 and Windows Azure. Pay-as-you-go model.