17
iText for Android / GAE Bruno Lowagie

Creating PDF on Android / Google App Engine

  • View
    1.015

  • Download
    2

Embed Size (px)

DESCRIPTION

iText Summit 2012 10:45 AM - 11:15 AM Creating PDF on Android / Google App Engine Bruno Lowagie, Founder of the iText Software Group.

Citation preview

Page 1: Creating PDF on Android / Google App Engine

iText  for  Android  /  GAE  Bruno  Lowagie  

Page 2: Creating PDF on Android / Google App Engine

What  is  iText?  

Java  

C#  

Page 3: Creating PDF on Android / Google App Engine

Web  applicaBons  

Cloud  services  

.NET  

JVM  

Java,  Groovy,  Scala,...  

C#  

Page 4: Creating PDF on Android / Google App Engine

Online  versus  Local  

Online  PDF  Genera-on  •  Your  invoice  •  Your  plane  Bcket  •  Your  bank  statement  •  Your  site’s  staBsBcs  •  Output  from  a  web  app  •  Print  on  Demand  •  ...  

Local  PDF  Genera-on  •  Output  from  a  desktop  app  •  Digital  signatures  •  Private  data  

–  Calls  log,  contact  list,...  –  Photos,  scans,...  

•  Offline  use  –  Document  as  data  container  

iText  for  Mobile?  

Page 5: Creating PDF on Android / Google App Engine

Let’s  make  an  Android  port  

•  Forbidden  classes:  – PdfGraphics2D:  removed  –  java.awt,  java.nio,...  references:  removed  –  java.awt.Color:  com.itextpdf.text.BaseColor  

•  Reduced  version  based  on  iText  5.0.7  

Page 6: Creating PDF on Android / Google App Engine
Page 7: Creating PDF on Android / Google App Engine

Lessons  learned  

•  PDF  creaBon  on  Android  is  as  easy  as  PDF  creaBon  in  a  “normal”  Java  applicaBon.  

•  PDF  viewers  on  Android  support  only  a  limited  subset  of  PDF  funcBonality:  – No  annotaBons,  such  as  links,  form  fields,...  – No  cool  stuff,  such  as  portable  collecBons,...  

•  Security:  – Problems  with  BouncyCastle  – Problems  connecBng  to  smartcard  reader  

Page 8: Creating PDF on Android / Google App Engine

Let’s  make  an  Android  port  

•  Forbidden  classes:  – PdfGraphics2D:  removed  –  java.awt,  java.nio,...  references:  replaced  –  java.awt.Color:  com.itextpdf.text.BaseColor  –  java.awt.*:  com.itextpdf.awt.*  

•  Security:  BouncyCastle  problems  – Use  SpongyCastle  instead  

•  Full  version  based  on  5.2.1-­‐SNAPSHOT  

Page 9: Creating PDF on Android / Google App Engine

We  have  a  port  for  GAE!  

Major  difference:  no  access  to  a  file  system!  •  You  can’t  write  to  a  file  – Use  a  ByteArrayOutputStream  instead  

•  Need  a  different  way  to  access  resources  – Fonts:  create  with  byte[]  –  Images:  create  with  byte[]  – PDFs:  create  a  PdfReader  with  byte[]  

Page 10: Creating PDF on Android / Google App Engine

Demo’s  PDF  creaBon  

Page 11: Creating PDF on Android / Google App Engine

Demo  PDF  manipulaBon  

Page 12: Creating PDF on Android / Google App Engine
Page 13: Creating PDF on Android / Google App Engine
Page 14: Creating PDF on Android / Google App Engine
Page 15: Creating PDF on Android / Google App Engine

Filled  out,  then  signed  

Page 16: Creating PDF on Android / Google App Engine

Lessons  learned  

•  PDF  creaBon  on  mobile  devices:  – OK  for  private  data  – Normally,  you’ll  create  documents  in  the  cloud  

•  PDF  manipulaBon:  – Document  as  data  container  –  Can  be  used  to  sign  documents!  

•  Security:  –  It  would  be  cool  if  we  could  connect  to  a  smartcard  reader  

Page 17: Creating PDF on Android / Google App Engine

On  our  roadmap  

•  Demo  Google  App  Engine  – Google  AnalyBcs  +  Google  Charts  

•  Demo  Heroku  – Watermarker  

•  Demo  CloudFoundry  – ???