Contenu connexe
Similaire à PDF is dead. Long live PDF... with Java! (20)
Plus de iText Group nv (9)
PDF is dead. Long live PDF... with Java!
- 1. © 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
- 2. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Is PDF dead?
PDF is dead; Long live PDF... and Java!2
- 3. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
PDF is dead; Long live PDF... and Java!3
The PDF Reference Manual
- 4. © 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/
- 5. © 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%
- 6. © 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 PDF
Leonard Rosenthol, PDF Architect at Adobe
- 7. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
… documents
PDF is dead; Long live PDF... and Java!7
Source:
The Future of PDF
Leonard Rosenthol, PDF Architect at Adobe
Needs to be self-contained
Unchanging (non-dynamic)
Able to be authenticated
Able to be secured/protected
- 8. © 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/
- 9. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Challenges for PDF Challengers
Offline 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
- 10. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Umbrella of Standards
PDF is dead; Long live PDF... and Java!10
PDF
Portable Document Format
First released in 1993
ISO Standard since 2008
ISO 32000
PDF/E
engineering
Since 2008
ISO 24517
PDF/VT
printing
Since 2010
ISO 16612
PDF/X
graphic arts
Since 2001
ISO 15930
PDF/A
archive
Since 2005
ISO 19005
PDF/UA
accessibility
Since 2012
ISO 14289
Related:
• XFDF (ISO)
• EcmaScript (ISO)
• PRC (ISO)
• PAdES (ETSI)
- 11. © 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
- 12. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Creating a PDF in 5 steps
Example 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
- 13. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
A “Hello World” PDF
PDF is dead; Long live PDF... and Java!13
- 14. © 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
- 15. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Filling out a form
Example 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
- 16. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
A filled out form
PDF is dead; Long live PDF... and Java!16
- 17. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Flattening out a form
Example 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
- 18. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
A flattened form
PDF is dead; Long live PDF... and Java!18
- 19. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Adding a watermark
Example 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
- 20. © 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
- 21. © 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
- 22. © 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
- 23. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Every one can read this
PDF is dead; Long live PDF... and Java!23
- 24. © 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
- 25. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Can every one read this?
PDF is dead; Long live PDF... and Java!25
- 26. © 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
RiskManagement
StructuredFinance
Mergers&acquisitions
Governance&InternalControl
AccountingOperations
Treasuryoperations
ManagementInformation&
BusinessDecisionSupport
BusinessPlanning&Strategy
FinanceContributiontoIT
Management
CommercialActivities
Taxation
FunctionalLeadership
- 27. © 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
- 28. © 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 documents
ISO 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
- 29. © 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
- 30. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Integrity
PDF is dead; Long live PDF... and Java!30
I paid a forged invoice
and lost $40K!
- 31. © 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!
- 32. © 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!
- 33. © 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
- 34. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
PAdES to the rescue!
ISO
ISO-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
- 35. © 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
- 36. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Paying invoices is a pain
PDF is dead; Long live PDF... and Java!36
- 37. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Processing invoices is a cost
PDF is dead; Long live PDF... and Java!37
- 38. © 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
- 39. © 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 documents
ISO 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,…
- 40. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Invoice + XML Attachment
PDF is dead; Long live PDF... and Java!40
- 41. © 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 invoices
ZUGFeRD: 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.
- 42. © 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?
- 43. © 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!
- 44. © 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
- 45. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step 1. Create PDF
PDF
PDF is dead; Long live PDF... and Java!45
- 46. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step1. Create PDF: Initialize document
Document 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
- 47. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step1. Create PDF: Add elements
Paragraph 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
- 48. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step 1. Create PDF: Close document
document.close();
PDF is dead; Long live PDF... and Java!48
- 49. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step 1. Create PDF: Result
PDF is dead; Long live PDF... and Java!49
- 50. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step 2. Create Tagged PDF
PDF is dead; Long live PDF... and Java!50
PDF
Tagged
content
Tagged
PDF
- 51. © 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();
PDF
Tagged
content
Tagged
PDF
PDF is dead; Long live PDF... and Java!51
- 52. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step 2. Create Tagged PDF
PDF is dead; Long live PDF... and Java!52
PDF
Tagged
content
Tagged
PDF
- 53. © 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 Metadata
Font
embedding
Alt text PDF/UA
- 54. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step 3. Create PDF/UA
Goals
Provide 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 Metadata
Font
embedding
Alt text PDF/UA
- 55. © 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 Metadata
Font
embedding
Alt text PDF/UA
- 56. © 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 Metadata
Font
embedding
Alt text PDF/UA
- 57. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step 3. Create PDF/UA
Goals
Make 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 Metadata
Font
embedding
Alt text PDF/UA
- 58. © 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 Metadata
Font
embedding
Alt text PDF/UA
- 59. © 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 Metadata
Font
embedding
Alt text PDF/UA
Before After
- 60. © 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 Metadata
Font
embedding
Alt text PDF/UA
- 61. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step 3. Create PDF/UA
Goals
Provide 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 Metadata
Font
embedding
Alt text PDF/UA
- 62. © 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 Metadata
Font
embedding
Alt text PDF/UA
- 63. © 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 Metadata
Font
embedding
Alt text PDF/UA
- 64. © 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 Metadata
Font
embedding
Alt text PDF/UA
- 65. © 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 Metadata
Font
embedding
Output
intents
PDF/A-3b
- 66. © 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 Metadata
Font
embedding
Output
intents
PDF/A-3b
- 67. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step 4. Create PDF/A-3b
Goals
Identify “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 Metadata
Font
embedding
Output
intents
PDF/A-3b
- 68. © 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 Metadata
Font
embedding
Output
intents
PDF/A-3b
- 69. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step 4. Create PDF/A-3b
Goals
Make document fully self contained and archivable
Same iText code as for PDF/UA
PDF is dead; Long live PDF... and Java!69
PDF Metadata
Font
embedding
Output
intents
PDF/A-3b
- 70. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Step 4. Create PDF/A-3b
Goals
Match 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 Metadata
Font
embedding
Output
intents
PDF/A-3b
- 71. © 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 Metadata
Font
embedding
Output
intents
PDF/A-3b
- 72. © 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 Metadata
Font
embedding
Output
intents
PDF/A-3b
- 73. © 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 Metadata
Font
embedding
Output
intents
PDF/A-3b
- 74. © 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/UA
PDF/A-
3a
- 75. © 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/UA
PDF/A-
3a
- 76. © 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/UA
PDF/A-
3a
- 77. © 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/UA
PDF/A-
3a
- 78. © 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/UA
PDF/A-
3a
- 79. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Create ZUGFeRD invoices
PDF is dead; Long live PDF... and Java!79
PDF/A-3b
XMP
metadata
Invoice
attachment
ZUGFeRD
PDF
- 80. © 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-3b
XMP
metadata
Invoice
attachment
ZUGFeRD
PDF
- 81. © 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-3b
XMP
metadata
Invoice
attachment
ZUGFeRD
PDF
- 82. © 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-3b
XMP
metadata
Invoice
attachment
ZUGFeRD
PDF
- 83. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Create ZUGFeRD invoices
PDF is dead; Long live PDF... and Java!83
PDF/A-3b
XMP
metadata
Invoice
attachment
ZUGFeRD
PDF
- 84. © 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
- 85. © 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
- 86. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Demo-time
PDF is dead; Long live PDF... and Java!86
- 87. © 2014, iText Group NV, iText Software Corp., iText Software BVBA© 2014, iText Group NV, iText Software Corp., iText Software BVBA
Finding Structure in PDF
- 88. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Listener for text snippets
public 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
- 89. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Parsing PDF
PdfReader 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
- 90. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Example page to parse
PDF is dead; Long live PDF... and Java!90
- 91. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Providing hints
PDF is dead; Long live PDF... and Java!91
- 92. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Providing hints
PDF is dead; Long live PDF... and Java!92
- 93. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Providing hints
PDF is dead; Long live PDF... and Java!93
- 94. © 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
- 95. © 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
- 96. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Roadmap 2012
Mobile versus Cloud
Android version
Google App Engine (GAE) Version
Digital Signatures
Update to new specs
Documentation
XML Worker / XFA Worker
Generic XML to PDF engine
Test with HTML, target XFA
PDF is dead; Long live PDF... and Java!96
- 97. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Roadmap 2013
Creating Tagged PDF
From high-level objects
From XFA Worker
Focus on standards
Rewriting the PDF/A functionality
Introducing PDF/UA support
PAdES 5
XML-DSig + XAdES
PDF is dead; Long live PDF... and Java!97
- 98. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Roadmap 2014
Major upgrade for RUPS
Reading and Updating PDF Syntax
XFA Worker: Enterprise-grade solution
Support for JavaScript
Standards
Complete PDF/UA
Complete PDF/A-2, PDF/A-3, ZUGFeRD
PDF is dead; Long live PDF... and Java!98
- 99. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Roadmap 2015
Customer-driven development
E.g. “Redaction”
Unstructured PDFs
Turn our research into development
PDF 2.0
Making iText ready for PDF 2.0
Next ISO Committee meeting: November 2014, Edinburgh
PDF is dead; Long live PDF... and Java!99
- 100. © 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
- 101. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
New book in the making
PDF is dead; Long live PDF... and Java!101
- 102. © 2014, iText Group NV, iText Software Corp., iText Software BVBA
Upcoming titles
PDF is dead; Long live PDF... and Java!102
- 103. © 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