Phpconf taiwan-2012

542 views
465 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
542
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Phpconf taiwan-2012

  1. 1. PHPConf Taiwan 2012November 03, 2012 at 10:10. Template-Based DOCX, DOC & PDF Generation with Zend Framework 2. @JonathanMaron E-Mail or Google+.
  2. 2. 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.com http://www.textcontrol.com
  3. 3. New approach to generatingDOCX, DOC, PDF etc. files with Zend Framework 2.
  4. 4. Creating PDFs with PHP HTML-to-PDF  Programmatic approach: approach:  domPDF.  Zend_Pdf.  HtmlToPdf.  PDFlib.  HTML_ToPDF.  FPDF.  wkhtmltopdf.  Cpdf.  etc.  etc.
  5. 5. Ralf Eggert quote “I personally consider the current version [of Zend_Pdf] to be limited in scope. It is extremelydifficult, if not impossible, to achieve usable results. At the moment, developers, including myself, are looking for alternatives [...]”PHP MagazinFebruary 2011 – March 2011, Ralf Eggert.
  6. 6. The template approach.
  7. 7. 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.
  8. 8. Sounds interesting.But how does it work?
  9. 9. 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
  10. 10. Document generation process (1) LiveDocxTemplate Document Data Template + Data = Document.
  11. 11. Step 1: Creating a template (2)
  12. 12. Steps 2 & 3: Assign data & create doc
  13. 13. Multiple output formats, one API
  14. 14. Sample 2:Merging complex data structures.
  15. 15. Repeating blocks (loops)
  16. 16. Sample 3:Merging image data.
  17. 17. Merging image data
  18. 18. Sample 4:Exporting to one or more image files.
  19. 19. Exporting to image files
  20. 20. Multiple output formats, one API
  21. 21. Working with templates: Local vs. remote.
  22. 22. Using local templates Specify template in every request.
  23. 23. Using remote templates Upload template once. Reference template in all subsequent requests.
  24. 24. Supported file formats.
  25. 25. Supported template formats (input) DOCX - Office Open XML format. DOC - Microsoft Word DOC format. RTF - Rich text format. TXD - TX Text Control format.
  26. 26. 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.
  27. 27. 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.
  28. 28. 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.
  29. 29. Case study:PHP Unconferences.
  30. 30. 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).
  31. 31. Live demonstrations SAMPLE 1: license-agreement SAMPLE 2: telephone-bill SAMPLE 3: conference-pass SAMPLE 4: bitmaps
  32. 32. Get involved! Try it out yourself! ZendService_LiveDocx Web Site. http://www.phplivedocx.org and http://goo.gl/oXUcf Download Demo VMware Virtual Machine http://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
  33. 33. Full-time web developer wanted! You love PHP, Zend Framework, HTML and 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!
  34. 34. 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.

×