Package org.europa.together.application
Class ITextRenderer
- java.lang.Object
-
- org.europa.together.application.ITextRenderer
-
- All Implemented Interfaces:
PdfRenderer
@Repository @FeatureToggle(featureID="CM-0011") public class ITextRenderer extends Object implements PdfRenderer
Implementation of a simple PDF Renderer.
-
-
Field Summary
-
Fields inherited from interface org.europa.together.business.PdfRenderer
FEATURE_ID
-
-
Constructor Summary
Constructors Constructor Description ITextRenderer()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAuthor()
Get the author of the document.String
getKeywords()
Get the document related keywords.String
getSubject()
Get the document subject.String
getTitle()
Get the document title.com.itextpdf.text.pdf.PdfReader
readDocument(File pdfDocument)
Read a PDF from FILE as PdfReader.com.itextpdf.text.pdf.PdfReader
removePage(com.itextpdf.text.pdf.PdfReader pdf, int... pages)
Remove from a given PDF pages.void
renderDocumentFromHtml(String file, String template)
Generate a PDF Document in the size A4 from a HTML String.void
setAuthor(String author)
Set the author for the document.void
setKeywords(String keywords)
Set hte keywords for the document.void
setSubject(String subject)
Set the document subject.void
setTitle(String title)
Set the document title.void
writeDocument(com.itextpdf.text.pdf.PdfReader pdf, String destination)
Writes a PDF document (PdfReader) to the given Destination.
-
-
-
Method Detail
-
writeDocument
public void writeDocument(com.itextpdf.text.pdf.PdfReader pdf, String destination)
Description copied from interface:PdfRenderer
Writes a PDF document (PdfReader) to the given Destination.- Specified by:
writeDocument
in interfacePdfRenderer
- Parameters:
pdf
- as PdfReaderdestination
- as String
-
renderDocumentFromHtml
public void renderDocumentFromHtml(String file, String template)
Description copied from interface:PdfRenderer
Generate a PDF Document in the size A4 from a HTML String. The file parameter define the path were the PDF will sored an how the document is named.- Specified by:
renderDocumentFromHtml
in interfacePdfRenderer
- Parameters:
file
- as Stringtemplate
- as String
-
readDocument
public com.itextpdf.text.pdf.PdfReader readDocument(File pdfDocument)
Description copied from interface:PdfRenderer
Read a PDF from FILE as PdfReader.- Specified by:
readDocument
in interfacePdfRenderer
- Parameters:
pdfDocument
- as File- Returns:
- pdf as PdfReader
-
removePage
public com.itextpdf.text.pdf.PdfReader removePage(com.itextpdf.text.pdf.PdfReader pdf, int... pages)
Description copied from interface:PdfRenderer
Remove from a given PDF pages. Usage:
PdfReader pdf = readDocument(new File(document.pdf)); File newPdf = removePages(pdf, 2, 4, 12);
Removes from the PDF document the Pages: 2,4 and 12.- Specified by:
removePage
in interfacePdfRenderer
- Parameters:
pdf
- as PdfReaderpages
- as int- Returns:
- pdf as PdfReader
-
setAuthor
public void setAuthor(String author)
Description copied from interface:PdfRenderer
Set the author for the document.- Specified by:
setAuthor
in interfacePdfRenderer
- Parameters:
author
- as String
-
setKeywords
public void setKeywords(String keywords)
Description copied from interface:PdfRenderer
Set hte keywords for the document.- Specified by:
setKeywords
in interfacePdfRenderer
- Parameters:
keywords
- as String
-
setSubject
public void setSubject(String subject)
Description copied from interface:PdfRenderer
Set the document subject.- Specified by:
setSubject
in interfacePdfRenderer
- Parameters:
subject
- as String
-
setTitle
public void setTitle(String title)
Description copied from interface:PdfRenderer
Set the document title.- Specified by:
setTitle
in interfacePdfRenderer
- Parameters:
title
- as String
-
getAuthor
public String getAuthor()
Description copied from interface:PdfRenderer
Get the author of the document.- Specified by:
getAuthor
in interfacePdfRenderer
- Returns:
- author as String
-
getKeywords
public String getKeywords()
Description copied from interface:PdfRenderer
Get the document related keywords.- Specified by:
getKeywords
in interfacePdfRenderer
- Returns:
- keywords as String
-
getSubject
public String getSubject()
Description copied from interface:PdfRenderer
Get the document subject.- Specified by:
getSubject
in interfacePdfRenderer
- Returns:
- subject as String
-
getTitle
public String getTitle()
Description copied from interface:PdfRenderer
Get the document title.- Specified by:
getTitle
in interfacePdfRenderer
- Returns:
- title as String
-
-