SlideShare a Scribd company logo
Charting a
Course through
PDFs and PHP
About Me
WorkingBuildings, LLC
In-house Developer
Worked with PHP since 2005




jsterry@gmail.com
@jerkob
The Problem


Get a chart that looks
the same on the web
and in a PDF.
Constraints
• Looks the Same on Screen and in Print
• Pure PHP or JavaScript/Flash with PHP
• Aesthetically Appealing
• Works in IE7+8
• Interactive
• Not Complicated
• Local (No Internet Required)
Image-based Charts

Generate 72 DPI Images

No interactivity

Reliable

Server-side

Weak aesthetics
Google Charts
JpGraph
pChart
Flash-based Charts
It’s Flash

iOS/Android compatibility

Generate images client-side

72 DPI resolution

Animation

Good aesthetics
Swiff Chart
Generator
Maani
Fusion
amCharts
AnyChart
Canvas-based Charts
 JavaScript

 Requires excanvas for IE < 9

 Not a very portable format

 Probably on the way out
jqPlot
SVG-based Charts
Works in all browsers (VML for IE)

Works without Flash (iOS)

JavaScript

Animation

Interactivity

Vector-based
Raphael/gRaphael
HighCharts
jQuery SVG
Also...

amCharts

Fusion

AnyChart
False Starts
Google Charts

jqPlot (Canvas to SVG)
So What Did We Use?
So What Did We Use?
Back to the Problem

Get a chart that looks
the same on the web
and in a PDF.
Constraints
• Looks the Same on Screen and in Print
• Pure PHP or JavaScript/Flash with PHP
• Aesthetically Appealing
• Works in IE7+8
• Interactive
• Not Complicated
• Local (No Internet Required)
What about PDFs?
PDF Libraries
FPDF

TCPDF

Zend PDF

PrinceXML

wkhtmltopdf

HTML2PDF

PDFLib
FPDF
Old

Reliable

Not UTF-8

Fast

No SVG

Flexible but difficult

Free
TCPDF
Fork of FPDF
Maintained
Powerful
Slower
UTF-8 support
SVG support (beta)
Flexible but difficult
Free
PrinceXML

Best SVG support

Easy to use (HTML and CSS)

Expensive

Supported
Others
Zend PDF

wkhtmltopdf

PDFLib

DomPDF

HTML2PDF
Code Example/Demo

More Related Content

KEY
corporateJavascript
PDF
Stress free development
PPTX
Aspect oriented programming
PPTX
SharePoint Conference North America - Converting your JavaScript to SPFX
PPTX
Lean Responsive
PDF
130511 stop wasting_your_time
PDF
Keeping lab notes as a software developer
PPTX
Java script introduction
corporateJavascript
Stress free development
Aspect oriented programming
SharePoint Conference North America - Converting your JavaScript to SPFX
Lean Responsive
130511 stop wasting_your_time
Keeping lab notes as a software developer
Java script introduction

What's hot (20)

PDF
Modern Messaging for Distributed Systems
PPTX
Windows 8
PPT
MSDN Live: Windows Presentation Foundations Line of Business Apps
PPTX
Wordpress hacks
ODP
D7 switching
PDF
Introduction to webpack and babel
PPTX
Enki.js, lessons learned while writing a javascript framework
PDF
Rasa Developer Summit - William Galindez Ariaz, Octesoft - Dial Rasa for Dinner
PDF
Transforming lives-with-teaching
PPTX
Software Craftsmanship @ Ntnu
PDF
Rasa Developer Summit - Tom Bocklisch, Rasa - Product Updates from Rasa
PDF
Mini-Training: NDepend
PDF
PDF
Tf itjsbagg
PDF
[DevDay 2017] ReactJS Hands on - Speaker: Binh Phan - Developer at mgm techno...
PPTX
Modern JavaScript Talk
PDF
Agile Nightmares
PDF
[DevDay 2017] Serverless Architecture - Speaker: Trung Huynh - Software Engin...
PDF
3 Gifts My Users Gave Me - Alexandra Draghici - WordCamp Europe 2017
PPTX
MVP Design Hacks: Sprint 5
Modern Messaging for Distributed Systems
Windows 8
MSDN Live: Windows Presentation Foundations Line of Business Apps
Wordpress hacks
D7 switching
Introduction to webpack and babel
Enki.js, lessons learned while writing a javascript framework
Rasa Developer Summit - William Galindez Ariaz, Octesoft - Dial Rasa for Dinner
Transforming lives-with-teaching
Software Craftsmanship @ Ntnu
Rasa Developer Summit - Tom Bocklisch, Rasa - Product Updates from Rasa
Mini-Training: NDepend
Tf itjsbagg
[DevDay 2017] ReactJS Hands on - Speaker: Binh Phan - Developer at mgm techno...
Modern JavaScript Talk
Agile Nightmares
[DevDay 2017] Serverless Architecture - Speaker: Trung Huynh - Software Engin...
3 Gifts My Users Gave Me - Alexandra Draghici - WordCamp Europe 2017
MVP Design Hacks: Sprint 5
Ad

Similar to Charts, PDFs, and PHP (20)

PPTX
An introduction to html5 by Devs
PDF
#PDR15 - Pebble Graphics
PDF
Understanding PDF workflows
PPTX
Practical html5
PDF
From Print Design to Web Design
PDF
Demystifying DITA to PDF Publishing
PPT
Spoilt for choice. Which prototyping tool is right for you? Presented by Suze...
PDF
A 'realistic' understanding of PDF production workflows
PDF
HTML5 Technical Executive Summary
PPTX
Easy charting with
PPTX
Spsmi13 charts
PDF
Lessons Learned from working with HTML5, GlassFish and NetBeans
PDF
Echo HTML5
PPT
Web Issues
PPT
Developing a practical HTML5 magazine workflow
PPTX
Activity 5
PDF
Making sense of the front-end, for PHP developers
PDF
Before Going Vector
PPT
STC Technical Communication Summit 2014 - D Gardiner
KEY
Adobe Air Application case study - nycoders.org 0509
An introduction to html5 by Devs
#PDR15 - Pebble Graphics
Understanding PDF workflows
Practical html5
From Print Design to Web Design
Demystifying DITA to PDF Publishing
Spoilt for choice. Which prototyping tool is right for you? Presented by Suze...
A 'realistic' understanding of PDF production workflows
HTML5 Technical Executive Summary
Easy charting with
Spsmi13 charts
Lessons Learned from working with HTML5, GlassFish and NetBeans
Echo HTML5
Web Issues
Developing a practical HTML5 magazine workflow
Activity 5
Making sense of the front-end, for PHP developers
Before Going Vector
STC Technical Communication Summit 2014 - D Gardiner
Adobe Air Application case study - nycoders.org 0509
Ad

Recently uploaded (20)

PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Approach and Philosophy of On baking technology
PPTX
1. Introduction to Computer Programming.pptx
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Mushroom cultivation and it's methods.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Getting Started with Data Integration: FME Form 101
Hindi spoken digit analysis for native and non-native speakers
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Unlocking AI with Model Context Protocol (MCP)
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Web App vs Mobile App What Should You Build First.pdf
Encapsulation_ Review paper, used for researhc scholars
A comparative analysis of optical character recognition models for extracting...
Assigned Numbers - 2025 - Bluetooth® Document
Univ-Connecticut-ChatGPT-Presentaion.pdf
SOPHOS-XG Firewall Administrator PPT.pptx
Approach and Philosophy of On baking technology
1. Introduction to Computer Programming.pptx
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Mushroom cultivation and it's methods.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Chapter 5: Probability Theory and Statistics
Digital-Transformation-Roadmap-for-Companies.pptx
1 - Historical Antecedents, Social Consideration.pdf
Getting Started with Data Integration: FME Form 101

Charts, PDFs, and PHP

Editor's Notes

  • #2: \n
  • #3: \n
  • #4: \n
  • #5: \n
  • #6: The issue with all of these was resolution - they all generate 72 DPI images that don&amp;#x2019;t print well. In addition they didn&amp;#x2019;t have interactivity and the look of the charts themselves was generally a step below.\n\n\n\n\n
  • #7: Flexible but a little complex.\n\nTried some &amp;#x201C;make it too large then scale it down&amp;#x201D; options, but that didn&amp;#x2019;t work well - fonts too small, spacing issues, etc. \n\nCan be ugly or can be nice depending on how much time you&amp;#x2019;re willing to put in.\n\nSSL issues\n\nGoogle could turn it off - see Google Translate\n
  • #8: PHP-based solution\n\nkind of ugly\n
  • #9: Just came out with a version 2.\n\nQuite good.\n\nLots of nice computation functions.\n
  • #10: The issues here are first, they&amp;#x2019;re Flash, and I don&amp;#x2019;t want to work with Flash (doesn&amp;#x2019;t work on iPad, etc.). Most of these can generate images as well but sometimes they do it client side instead of server side which is not useful. Plus the resolution of the generated images was 72 DPI in all the ones I tried.\n\n\n\n\n\n
  • #11: Flash-based which I was trying to avoid. \n\nIn researching this I found that it could be a good solution with how it works now. When I was looking at it my understanding was that to get the other formats, you first had to load the Flash graph and then it would be able to generate the SVG. I think now you can have it choose server side what to do. \n\nCould be another good option.\n
  • #12: Maani.us Flash/XML charts\n\nFlash-based, export to image\n\nimage is 72 DPI, and is a client side prompt (this was true of a lot of Flash charts I looked at - the Flash had to be loaded on screen and then it would download)\n\n
  • #13: v3 is implementing a SVG-based JavaScript solution - based on HighCharts!\n
  • #14: Implementing a SVG-based JavaScript solution as well\n\nCan export as image or PDF, but requires server-side script to handle the passed image data. I would bet resolution is 72 DPI.\n
  • #15: JavaScript-based solution in beta\n\nVideo on their website of it running on an iPad\n\n\n
  • #16: Google Charts - not local, 72 DPI, no option for different resolution. Flexible but a little complex. Tried some &amp;#x201C;make it too large then scale it down&amp;#x201D; options, but that didn&amp;#x2019;t work well - fonts too small, spacing issues, etc.\nSwiff Chart Generator - Flash-based which I was trying to avoid. In researching this I found that it could be a good solution with how it works now. When I was looking at it my understanding was that to get the other formats, you first had to load the Flash graph and then it would be able to generate the SVG. I think now you can have it choose server side what to do. Could be another good option.\nMaani Charts - Flash-based, export to image - image is 72 DPI, and is a client side prompt (this was true of a lot of Flash charts I looked at - the Flash had to be loaded on screen and then it would download)\nRaphael/gRaphael - In development so a little early. When I was looking it was quite early. But a good option.\njQuery SVG - has charting extensions, kind of ugly\nsvgweb - semi-Google project. In beta, not targeted at charting\njqPlot - uses canvas.\n\n\n\n
  • #17: Requires jQuery\n\nRequires excanvas\n\nWe tried this, and even looked at doing canvas to SVG conversions\n
  • #18: \n\n\n\n
  • #19: Really beautiful\n\nDoes not require jQuery\n\nIn development - missing a lot of functionality\n\nFree\n
  • #20: Free for non-commercial\n\nMature\n\nRequires jQuery\n\nHelps with time-based axes\n\nWorking on stock charts\n\nReally great support forums\n
  • #21: More of a build-your-own\n\nFree\n\njQuery Required\n\nNot graph-focused\n
  • #22: \n
  • #23: \n
  • #24: Came out with SVG-beta right when we needed this\n
  • #25: \n
  • #26: \n
  • #27: \n
  • #28: \n
  • #29: \n
  • #30: Some other PDF libraries (like HTML2PDF) are based on TCPDF\n
  • #31: \n
  • #32: Zend PDF doesn&amp;#x2019;t support SVG\nwkhtmltopdf has PHP bindings but they are complex to implement\n\n
  • #33: \n