vectors & rasters
Handling
performance, decisions and understanding context
upload PDFs, draw content
iOS
2 colors tint
Needed for large documents
Needed for zooming
http://pdfobject.com/examples/
https://github.com/mozilla/pdf.js
http://pdfobject.com/examples/
https://github.com/mozilla/pdf.js
Raster: JPEG / GIF / PNG
Vector: SVG
Pan/Zoom, SVG Drawings, 2 color overlay
Cannot trace embeded images to vectors
Original PDF:
SVG:
Optimized SVG:
0.6 MB
6.8 MB
1.7 MB
SVG:
Optimized SVG:
10 fps
20 fps
SVG
https://github.com/Gottox/node-pdfutils
Optimized SVG
https://github.com/svg/svgo
Didn't matter what was embeded
Original PDF:
PNG:
JPEG:
GIF:
0.6 MB
4.7 MB
4.3 MB
2.6 MB
>30 fps
Use Raphael for SVG annotations
Convert PDFs to PNG
for JPEG & PNG
apparently frickin' GIF works
only 256 distinctive colors
enough for our b/w documents
3-5 decoded Mpx
decent for our use case
http://www.williammalone.com/articles/html5-javascript-ios-maximum-image-size/
Takes seconds to create the composite.
Sync operation / blocks the UI.
Not cached.
Use Web Workers for async/non-blocking.
Parsing parallelization.
Render on server, lazy on first request, and store it.
Serve it directly, if already rendered.
Automatically cached on client.
Use raster images instead, if applicable.
... but large images are slow to parse.
Use Web Workers, parallelization.
JavaScript is slow with large data
iOS 8 bug, with Raphael + JPG/PNG.
3 - 5 Mpx hard limit.
Applies to canvas, also.