PDF is dead. Long live PDF... with Java!

103
© 2014, iText Group NV, iText Software Corp., iText Software BVBA © 2014, iText Group NV, iText Software Corp., iText Software BVBA PDF is dead! Long live PDF! Java One Tutorial 29/09/2014

description

These are the slides of the iText talk at Java One 2014.

Transcript of PDF is dead. Long live PDF... with Java!

Page 1: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA

PDF is dead! Long live PDF!Java One Tutorial 29/09/2014

Page 2: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Is PDF dead?

PDF is dead; Long live PDF... and Java!2

Page 3: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

PDF is dead; Long live PDF... and Java!3

The PDF Reference Manual

Page 4: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Everybody uses HTML

PDF is dead; Long live PDF... and Java!4

Source:http://duff-johnson.com/2014/03/10/98-percent-of-dot-com-is-html-but-38-percent-of-dot-gov-is-pdf/

Page 5: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

But governments also like PDF

PDF is dead; Long live PDF... and Java!5

Source:http://duff-johnson.com/2014/03/10/98-percent-of-dot-com-is-html-but-38-percent-of-dot-gov-is-pdf/

Percentage of PDF files:.org: 15%.gov: 38%.edu: 27%

Page 6: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Publications versus…

No need to be self-contained and may change over time

Not all content produced by the author

e.g. Advertisements

Becoming more interactive

e.g Comments on a news article

PDF is dead; Long live PDF... and Java!6

Source:The Future of PDFLeonard Rosenthol, PDF Architect at Adobe

Page 7: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

… documents

PDF is dead; Long live PDF... and Java!7

Source:The Future of PDFLeonard Rosenthol, PDF Architect at Adobe

Needs to be self-contained

Unchanging (non-dynamic)

Able to be authenticated

Able to be secured/protected

Page 8: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Not counting HTML, PDF is King

PDF is dead; Long live PDF... and Java!8

Source:http://duff-johnson.com/2014/02/17/the-8-most-popular-document-formats-on-the-web/

Page 9: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Challenges for PDF ChallengersOffline consumption

PDF Viewers are ubiquitous (Adobe Reader is on 90% of the desk tops)

Mobile consumption

Interactivity (forms, commenting,…)

Reading books on eReaders

Attacking the weaknesses of PDF

PDF suffers from “too much” functionality

PDF was designed in a “pre-hacker” world

Not all tools are created equal

• Producers don’t use best practices (e.g. Tagged PDF)

• Not all viewers support all features (e.g. EcmaScript)

PDF is dead; Long live PDF... and Java!9

Page 10: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Umbrella of Standards

PDF is dead; Long live PDF... and Java!10

PDFPortable Document FormatFirst released in 1993ISO Standard since 2008

ISO 32000

PDF/Eengineering

Since 2008

ISO 24517

PDF/VTprinting

Since 2010

ISO 16612

PDF/Xgraphic arts

Since 2001

ISO 15930

PDF/Aarchive

Since 2005

ISO 19005

PDF/UAaccessibility

Since 2012

ISO 14289

Related:• XFDF (ISO)• EcmaScript (ISO)• PRC (ISO)• PAdES (ETSI)

Page 11: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Hello iText

PDF is dead; Long live PDF... and Java!11

Page 12: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Creating a PDF in 5 stepsExample 1: Hello World with iText

public void createPdf(String dest)

throws DocumentException, IOException {

// step 1

Document document = new Document();

// step 2

PdfWriter.getInstance(document, new FileOutputStream(dest));

// step 3

document.open();

// step 4

document.add(new Paragraph("Hello World!"));

// step 5

document.close();

}

PDF is dead; Long live PDF... and Java!12

Page 13: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

A “Hello World” PDF

PDF is dead; Long live PDF... and Java!13

Page 14: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

A simple form with three fields

PDF is dead; Long live PDF... and Java!14

Example : Filling out an existing form

Page 15: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Filling out a formExample 2.a: Filling out a form

public void manipulatePdf(String src, String dest)

throws DocumentException, IOException {

PdfReader reader = new PdfReader(src);

PdfStamper stamper =

new PdfStamper(reader, new FileOutputStream(dest));

AcroFields form = stamper.getAcroFields();

form.setField("Name", "Raf Hens");

form.setField("Company", "iText Software");

form.setField("Country", "BELGIUM");

stamper.close();

reader.close();

}

PDF is dead; Long live PDF... and Java!15

Page 16: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

A filled out form

PDF is dead; Long live PDF... and Java!16

Page 17: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Flattening out a formExample 2.b: Flattening a form

public void manipulatePdf(String src, String dest)

throws DocumentException, IOException {

PdfReader reader = new PdfReader(src);

PdfStamper stamper =

new PdfStamper(reader, new FileOutputStream(dest));

AcroFields form = stamper.getAcroFields();

form.setField("Name", "Bruno Lowagie");

form.setField("Company", "iText Group");

form.setField("Country", "BELGIUM");

stamper.setFormFlattening(true);

stamper.close();

reader.close();

}

PDF is dead; Long live PDF... and Java!17

Page 18: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

A flattened form

PDF is dead; Long live PDF... and Java!18

Page 19: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Adding a watermarkExample 3: Stamping content on a PDF

public void manipulatePdf(String src, String dest)

throws DocumentException, IOException {

PdfReader reader = new PdfReader(src);

PdfStamper stamper =

new PdfStamper(reader, new FileOutputStream(dest));

PdfContentByte under = stamper.getUnderContent(1);

ColumnText.showTextAligned(under, Element.ALIGN_CENTER,

new Phrase("Watermark", new Font(FontFamily.HELVETICA, 120)),

297, 421, 45);

stamper.close();

reader.close();

}

PDF is dead; Long live PDF... and Java!19

Page 20: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA

The importance of standards

Three use cases

Page 21: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Speaking the same language

Not being able to understand each other is a punishment, NOT a business model!

Standards are about speaking the same language!

PDF is dead; Long live PDF... and Java!21

Page 22: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA

PDF/UA

ISO 14289: Universal Accessibility

Page 23: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Every one can read this

PDF is dead; Long live PDF... and Java!23

Page 24: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

But some structure is helpful

PDF is dead; Long live PDF... and Java!24

title

list item

list item

list item

Label Content

Page 25: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Can every one read this?

PDF is dead; Long live PDF... and Java!25

Page 26: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

How do we read the spider chart?

PDF is dead; Long live PDF... and Java!26

Person 2 1.7 1.4 1.3 1.9 2.1 0.8 2.2 1.8 1.6 1 1.4

Position 3 2.3 2 1.8 3.2 3.9 2.1 3.1 3.2 2.3 2 2.1

Ris

k M

anag

em

en

t

Stru

ctu

red

Fin

ance

Me

rge

rs &

acq

uis

itio

ns

Go

vern

ance

& In

tern

al C

on

tro

l

Acc

ou

nti

ng

Op

era

tio

ns

Tre

asu

ry o

pe

rati

on

s

Man

age

me

nt

Info

rmat

ion

&

Bu

sin

ess

De

cisi

on

Su

pp

ort

Bu

sin

ess

Pla

nn

ing

& S

trat

egy

Fin

ance

Co

ntr

ibu

tio

n t

o IT

M

anag

em

en

t

Co

mm

erc

ial A

ctiv

itie

s

Taxa

tio

n

Fun

ctio

nal

Le

ade

rsh

ip

Page 27: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Is this a better way to read the data?

PDF is dead; Long live PDF... and Java!27

Person Position

Functional Leadership 2 3

Risk Management 1.7 2.3

Structured Finance 1.4 2

Mergers & Acquisitions 1.3 1.8

Governance & Internal Control 1.9 3.2

Accounting Operations 2.1 3.9

Treasury Operations 0.8 2.1

Management Information & Business Decision Support 2.2 3.1

Business Planning & Strategy 1.8 3.2

Finance Contribution to IT Managemen 1.6 2.3

Commencial Activities 1 2

Taxation 1.4 2.1

Page 28: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

PDF/UA to the rescue

Let’s agree on a standard way to store/interpret documentsISO 14289: Universal Accessibility

PDF/UA is a technical specification intended for developers implementing PDF writing and processing software.

PDF/UA provides definitive terms and requirements to allow people with/without disabilities the same rights.

For those equipped with appropriate software, conformance with PDF/UA ensures accessibility for people with disabilities who use assistive technology such as screen readers, screen magnifiers, joysticks and other technologies to navigate and read electronic content.

PDF is dead; Long live PDF... and Java!28

Page 29: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA

PAdES

ETSI TS 102 778: PDF Advanced Electronic Signatures

Page 30: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Integrity

PDF is dead; Long live PDF... and Java!30

I paid a forged invoiceand lost $40K!

Page 31: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Authenticity

PDF is dead; Long live PDF... and Java!31

Why am I, Emperor Constantine I, in this picture? I never transferred

authority to the Pope!

Page 32: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Non-repudiation

PDF is dead; Long live PDF... and Java!32

I didn’t do it!

Page 33: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Business requirements for signatures

PDF is dead; Long live PDF... and Java!33

Let’s agree on a standard, vendor-independent way to ensure document integrity, authentication and non-repudiation

Page 34: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

PAdES to the rescue!

ISOISO-32000-1 (2008) based on PDF 1.7 (2006)

ISO-32000-2 will define PDF 2.0 (2016)

ETSI: TS 102 778 (2009 - 2010)PAdES 1: Overview

PAdES 2: Basic – CMS based (ISO-32000-1)

PAdES 3: Enhanced – CAdES based (ISO-32000-2)

PAdES 4: LTV – Long Term Validation

PAdES 5: XAdES based (XML content)

PAdES 6: Visual representation guidelines

ETSI: TS 103 172 (2011 - 2013)PAdES Baseline Profile

PDF is dead; Long live PDF... and Java!34

Page 35: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA

PDF/A-3 - ZUGFeRD

ISO 19005-3: Archiving

ZUGFeRD: Invoicing

Page 36: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Paying invoices is a pain

PDF is dead; Long live PDF... and Java!36

Page 37: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Processing invoices is a cost

PDF is dead; Long live PDF... and Java!37

Page 38: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

We need a standard!

What if a vendor would provide an invoice that:Can be read by a human being? (Use PDF?)

Can be processed by a machine? (Use XML?)

What would it take to make sure that:You don’t have to do any manual work to input the amount to be paid, sales tax,…? (Structured info?)

The invoice can be preserved for the long term? (PDF/A?)

PDF is dead; Long live PDF... and Java!38

Page 39: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

PDF/A-3 to the rescue!

PDF is dead; Long live PDF... and Java!39

Let’s agree on a standard way to archive documentsISO 19005 part 3:

PDF/A is an ISO-standardized version of the Portable Document Format (PDF) specialized for the digital preservation of electronic documents.

PDF/A-3 allows attachments that are not compliant with PDF/A, e.g. an e-mail, machine readable data such as an XML file,…

Page 40: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Invoice + XML Attachment

PDF is dead; Long live PDF... and Java!40

Page 41: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

ZUGFeRD to the rescue!

PDF is dead; Long live PDF... and Java!41

Let’s agree on a standard way to exchange invoicesZUGFeRD: a pioneer to fix PDF invoicing

Developed by a Workgroup called “Forum elektronische Rechnung Deutschland” (FeRD).

Based on PDF/A-3: archiving + attachment.

Imposes an XML schema for the data added in attachment.

Data can be extracted and processed without human intervention:

• This speeds up the processing of invoices,

• Makes the process less error-prone, and

• Reduces the cost.

Page 42: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Conclusions

Why are standards important in business?

Page 43: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

PDF is dead; Long live PDF... and Java!43

Standards ensure:

Clarity, as shown in the PDF/UA use case,

Security, as shown in the PAdES use case,

Interoperability, as shown in the ZUGFeRD use case,

And much more!

Page 44: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Creating PDF/UA, PDF/A-3, ZUGFeRD

Page 45: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 1. Create PDF

PDF

PDF is dead; Long live PDF... and Java!45

Page 46: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step1. Create PDF: Initialize documentDocument document = new Document();

PdfWriter writer =

PdfWriter.getInstance(document,

new FileOutputStream("SimplePdf.pdf"));

writer.setPdfVersion(PdfWriter.VERSION_1_7);

document.open();

PDF is dead; Long live PDF... and Java!46

Page 47: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step1. Create PDF: Add elementsParagraph p = new Paragraph();

Chunk c = new Chunk("The quick brown ");

p.add(c);

Image i = Image.getInstance("fox.bmp");

c = new Chunk(i, 0, -24);

p.add(c);

c = new Chunk(" jumps over the lazy ");

p.add(c);

i = Image.getInstance("dog.bmp");

c = new Chunk(i, 0, -24);

p.add(c);

document.add(p);

PDF is dead; Long live PDF... and Java!47

Page 48: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 1. Create PDF: Close documentdocument.close();

PDF is dead; Long live PDF... and Java!48

Page 49: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 1. Create PDF: Result

PDF is dead; Long live PDF... and Java!49

Page 50: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 2. Create Tagged PDF

PDF is dead; Long live PDF... and Java!50

PDFTagged content

Tagged PDF

Page 51: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 2. Create Tagged PDF

PdfWriter writer = PdfWriter.getInstance(…);

writer.setPdfVersion(PdfWriter.VERSION_1_7);

writer.setTagged();

document.open();

PDFTagged content

Tagged PDF

PDF is dead; Long live PDF... and Java!51

Page 52: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 2. Create Tagged PDF

PDF is dead; Long live PDF... and Java!52

PDFTagged content

Tagged PDF

Page 53: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

PDF is dead; Long live PDF... and Java!53

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Page 54: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

GoalsProvide document title, author, keywords

Provide document language for better accessibility

Identify “type” of PDF (PDF/UA) to help PDF reader

PDF is dead; Long live PDF... and Java!54

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Page 55: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

writer.setTagged();

writer.setViewerPreferences

(PdfWriter.DisplayDocTitle);

document.addLanguage("en-US");

document.addTitle("English pangram");

writer.createXmpMetadata();

document.open();

PDF is dead; Long live PDF... and Java!55

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Page 56: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

PDF is dead; Long live PDF... and Java!56

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Page 57: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

GoalsMake document independent of font set of current OS

Make document independent of font selection strategy of PDF reader

Make document fully portable

PDF is dead; Long live PDF... and Java!57

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Page 58: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

document.open();

Paragraph p = new Paragraph();

p.setFont(FontFactory.getFont("FreeSans.ttf",

BaseFont.WINANSI, BaseFont.EMBEDDED, 20));

Chunk c = new Chunk("The quick brown ");

p.add(c);

PDF is dead; Long live PDF... and Java!58

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Page 59: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

PDF is dead; Long live PDF... and Java!59

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Before After

Page 60: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

PDF is dead; Long live PDF... and Java!60

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Page 61: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

GoalsProvide alternate text for non-textual content

Help conforming readers to read out loud the non-textual content

PDF is dead; Long live PDF... and Java!61

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Page 62: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

Image i = Image.getInstance("fox.bmp");

c = new Chunk(i, 0, -24);

c.setAccessibleAttribute(PdfName.ALT,

new PdfString("Fox"));

p.add(c);

PDF is dead; Long live PDF... and Java!62

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Page 63: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

PDF is dead; Long live PDF... and Java!63

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Page 64: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 3. Create PDF/UA

PDF is dead; Long live PDF... and Java!64

Tagged PDF MetadataFont

embeddingAlt text PDF/UA

Page 65: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 4. Create PDF/A-3b

PDF is dead; Long live PDF... and Java!65

PDF MetadataFont

embeddingOutput intents

PDF/A-3b

Page 66: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 4. Create PDF/A-3b

Document document = new Document();

PdfAWriter writer = PdfAWriter.getInstance(document,

new FileOutputStream("PdfA3b.pdf"),

PdfAConformanceLevel.PDF_A_3B);

writer.setPdfVersion(PdfWriter.VERSION_1_7);

PDF is dead; Long live PDF... and Java!66

PDF MetadataFont

embeddingOutput intents

PDF/A-3b

Page 67: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 4. Create PDF/A-3b

GoalsIdentify “type” of PDF (PDF/A) to help PDF reader

Similar iText code as for PDF/UA

PDF is dead; Long live PDF... and Java!67

PDF MetadataFont

embeddingOutput intents

PDF/A-3b

Page 68: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 4. Create PDF/A-3b

PDF is dead; Long live PDF... and Java!68

PDF MetadataFont

embeddingOutput intents

PDF/A-3b

Page 69: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 4. Create PDF/A-3b

GoalsMake document fully self contained and archivable

Same iText code as for PDF/UA

PDF is dead; Long live PDF... and Java!69

PDF MetadataFont

embeddingOutput intents

PDF/A-3b

Page 70: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 4. Create PDF/A-3b

GoalsMatch color characteristics of PDF document with color characteristics of

device on which it is intended to be rendered

Make colors device independent

PDF is dead; Long live PDF... and Java!70

PDF MetadataFont

embeddingOutput intents

PDF/A-3b

Page 71: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 4. Create PDF/A-3b

document.open();

ICC_Profile icc = ICC_Profile.getInstance(new

FileInputStream("sRGB Color Space

Profile.icm"));

writer.setOutputIntents("Custom", "",

"http://www.color.org", "sRGB IEC61966-2.1",

icc);

Paragraph p = new Paragraph();

PDF is dead; Long live PDF... and Java!71

PDF MetadataFont

embeddingOutput intents

PDF/A-3b

Page 72: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 4. Create PDF/A-3b

PDF is dead; Long live PDF... and Java!72

PDF MetadataFont

embeddingOutput intents

PDF/A-3b

Page 73: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 4. Create PDF/A-3b

PDF is dead; Long live PDF... and Java!73

PDF MetadataFont

embeddingOutput intents

PDF/A-3b

Page 74: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 5. Create PDF/A-3a

PDF is dead; Long live PDF... and Java!74

PDF/A-3b

PDF/UAPDF/A-

3a

Page 75: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 5. Create PDF/A-3a

Document document = new Document();

PdfAWriter writer = PdfAWriter.getInstance(document,

new FileOutputStream("PdfA3a.pdf"),

PdfAConformanceLevel.PDF_A_3A);

writer.setPdfVersion(PdfWriter.VERSION_1_7);

PDF is dead; Long live PDF... and Java!75

PDF/A-3b

PDF/UAPDF/A-

3a

Page 76: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 5. Create PDF/A-3a

PDF is dead; Long live PDF... and Java!76

PDF/A-3b

PDF/UAPDF/A-

3a

Page 77: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 5. Create PDF/A-3a

Can I make sure that my document is compliant?

iText will:

Perform a lot of checks, from technical PoV, based on the requested conformance level

Throw an exception if a requirement is not met

Not everything can be checked automatically!

PDF is dead; Long live PDF... and Java!77

PDF/A-3b

PDF/UAPDF/A-

3a

Page 78: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Step 5. Create PDF/A-3a

PDF is dead; Long live PDF... and Java!78

PDF/A-3b

PDF/UAPDF/A-

3a

Page 79: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Create ZUGFeRD invoices

PDF is dead; Long live PDF... and Java!79

PDF/A-3bXMP

metadataInvoice

attachmentZUGFeRD

PDF

Page 80: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Create ZUGFeRD invoices

Document document = new Document();

PdfAWriter writer = PdfAWriter.getInstance(document,

new FileOutputStream("Zugferd.pdf"),

PdfAConformanceLevel.ZUGFeRD);

writer.setPdfVersion(PdfWriter.VERSION_1_7);

PDF is dead; Long live PDF... and Java!80

PDF/A-3bXMP

metadataInvoice

attachmentZUGFeRD

PDF

Page 81: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Create ZUGFeRD invoices

writer.createXmpMetadata();

writer.getXmpWriter().setProperty(

PdfAXmpWriter.zugferdSchemaNS,

PdfAXmpWriter.zugferdDocumentFileName,

"invoice.xml");

document.open();

PDF is dead; Long live PDF... and Java!81

PDF/A-3bXMP

metadataInvoice

attachmentZUGFeRD

PDF

Page 82: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Create ZUGFeRD invoices

PdfFileSpecification fileSpec =

writer.addFileAttachment("ZUGFeRD invoice",

null, "c:/invoice.xml", "invoice.xml",

"application/xml",

new AFRelationshipValue.Alternative);

PDF is dead; Long live PDF... and Java!82

PDF/A-3bXMP

metadataInvoice

attachmentZUGFeRD

PDF

Page 83: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Create ZUGFeRD invoices

PDF is dead; Long live PDF... and Java!83

PDF/A-3bXMP

metadataInvoice

attachmentZUGFeRD

PDF

Page 84: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA

The DNA of PDF

The Structure of a PDF file

Looking at a PDF from a text editor

Browsing Java objects using Java Swing

Page 85: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

The structure of a PDF file

PDF is dead; Long live PDF... and Java!85

Header

Body

Cross-Reference Table

Trailer

Page 86: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Demo-time

PDF is dead; Long live PDF... and Java!86

Page 87: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Finding Structure in PDF

Page 88: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Listener for text snippetspublic class MyTextRenderListener implements RenderListener {

public void beginTextBlock() {

System.out.println("<");

}

public void endTextBlock() {

System.out.println(">");

}

public void renderImage(ImageRenderInfo renderInfo) {

}

public void renderText(TextRenderInfo renderInfo) {

System.out.println(" <");

Vector start = renderInfo.getBaseline().getStartPoint();

System.out.println(String.format(" x: %s y: %s length: %s \n Text: %s",

start.get(Vector.I1), start.get(Vector.I2),

renderInfo.getBaseline().getLength(), renderInfo.getText()));

out.println(" >");

}

}

PDF is dead; Long live PDF... and Java!88

Page 89: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Parsing PDFPdfReader reader = new PdfReader(src);

RenderListener listener = new MyTextRenderListener();

PdfContentStreamProcessor processor = new PdfContentStreamProcessor(listener);

PdfDictionary pageDic = reader.getPageN(1);

PdfDictionary resourcesDic =

pageDic.getAsDict(PdfName.RESOURCES);

processor.processContent(

ContentByteUtils.getContentBytesForPage(reader, 1), resourcesDic);

reader.close();

PDF is dead; Long live PDF... and Java!89

Page 90: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Example page to parse

PDF is dead; Long live PDF... and Java!90

Page 91: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Providing hints

PDF is dead; Long live PDF... and Java!91

Page 92: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Providing hints

PDF is dead; Long live PDF... and Java!92

Page 93: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Providing hints

PDF is dead; Long live PDF... and Java!93

Page 94: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Demo

Finding text snippets

Finding text lines

Finding text structure

PDF is dead; Long live PDF... and Java!94

Page 95: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Wrapping up

The Technical Roadmap for iText

Further reading

Q&A

Page 96: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Roadmap 2012

Mobile versus CloudAndroid version

Google App Engine (GAE) Version

Digital SignaturesUpdate to new specs

Documentation

XML Worker / XFA WorkerGeneric XML to PDF engine

Test with HTML, target XFA

PDF is dead; Long live PDF... and Java!96

Page 97: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Roadmap 2013

Creating Tagged PDFFrom high-level objects

From XFA Worker

Focus on standardsRewriting the PDF/A functionality

Introducing PDF/UA support

PAdES 5XML-DSig + XAdES

PDF is dead; Long live PDF... and Java!97

Page 98: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Roadmap 2014

Major upgrade for RUPSReading and Updating PDF Syntax

XFA Worker: Enterprise-grade solutionSupport for JavaScript

StandardsComplete PDF/UA

Complete PDF/A-2, PDF/A-3, ZUGFeRD

PDF is dead; Long live PDF... and Java!98

Page 99: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Roadmap 2015

Customer-driven developmentE.g. “Redaction”

Unstructured PDFsTurn our research into development

PDF 2.0Making iText ready for PDF 2.0

Next ISO Committee meeting: November 2014, Edinburgh

PDF is dead; Long live PDF... and Java!99

Page 100: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Books published by Manning

PDF is dead; Long live PDF... and Java!100

1st Edition: 2006• 11.500 copies

2nd Edition: 2010• 8.000 copies

Page 101: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

New book in the making

PDF is dead; Long live PDF... and Java!101

Page 102: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

Upcoming titles

PDF is dead; Long live PDF... and Java!102

Page 103: PDF is dead. Long live PDF... with Java!

© 2014, iText Group NV, iText Software Corp., iText Software BVBA

PDF is dead; Long live PDF... and Java!103

Thank you!

Questions and answers

Visit us at booth #5712