From 9efdadcdcaf8e9b13ef6cf27a6646e528198a7af Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 24 Oct 2017 13:14:53 +0200 Subject: [PATCH] Compatibility with OpenPDF as alternative to iText 2.1.7 Issue: SPR-16107 --- .../view/document/AbstractPdfStamperView.java | 5 +++++ .../servlet/view/document/AbstractPdfView.java | 18 +++++++++++------- src/docs/asciidoc/web/webmvc-view.adoc | 4 ++-- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfStamperView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfStamperView.java index f437090e528..f52b7f6e801 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfStamperView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfStamperView.java @@ -33,6 +33,11 @@ import org.springframework.web.servlet.view.AbstractUrlBasedView; * document with an AcroForm. Application-specific view classes * will extend this class to merge the PDF form with model data. * + *

This view implementation uses Bruno Lowagie's + * iText package. + * Known to work with iText 2.1.7 as well as its fork + * OpenPDF. + * *

Thanks to Bryant Larsen for the suggestion and the original prototype! * * @author Juergen Hoeller diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfView.java index 516425c3999..f3baaae4ede 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/document/AbstractPdfView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,13 +30,17 @@ import com.lowagie.text.pdf.PdfWriter; import org.springframework.web.servlet.view.AbstractView; /** - * Abstract superclass for PDF views, using Bruno Lowagie's - * iText package. - * Application-specific view classes will extend this class. - * The view will be held in the subclass itself, not in a template. + * Abstract superclass for PDF views. Application-specific view classes + * will extend this class. The view will be held in the subclass itself, + * not in a template. * - *

Note: Internet Explorer requires a ".pdf" extension, as - * it doesn't always respect the declared content type. + *

This view implementation uses Bruno Lowagie's + * iText package. + * Known to work with iText 2.1.7 as well as its fork + * OpenPDF. + * + *

Note: Internet Explorer requires a ".pdf" extension, as it doesn't + * always respect the declared content type. * * @author Rod Johnson * @author Juergen Hoeller diff --git a/src/docs/asciidoc/web/webmvc-view.adoc b/src/docs/asciidoc/web/webmvc-view.adoc index a15e8c3a061..11ff4c19510 100644 --- a/src/docs/asciidoc/web/webmvc-view.adoc +++ b/src/docs/asciidoc/web/webmvc-view.adoc @@ -1930,8 +1930,8 @@ dynamically from the model data. The document is the view and will be streamed f server with the correct content type to (hopefully) enable the client PC to run their spreadsheet or PDF viewer application in response. -In order to use Excel views, you need to add the 'poi' library to your classpath, and -for PDF generation, the iText library. +In order to use Excel views, you need to add the Apache POI library to your classpath, +and for PDF generation, the common iText 2.1.7 or its fork OpenPDF (e.g. OpenPDF 1.0.4).