Package org.europa.together.business
Interface PdfRenderer
- All Known Implementing Classes:
OpenPdfRenderer
@API(status=STABLE,
since="1.0",
consumers="OpenPdfRenderer")
@Component
public interface PdfRenderer
Basic PDF functionality to generate from an application letters or reports.
- Since:
- 1.0
- Version:
- 1.2
- Author:
- elmar.dott@gmail.com
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionGet the author of the document.Get the document related keywords.Get the document subject.getTitle()
Get the document title.loadDocument
(File pdfDocument) Read a PDF from FILE as PdfReader.removePage
(PdfDocument pdf, int... pages) Remove from a given PDF pages.void
renderDocumentFromHtml
(String file, String htmlTemplate) Generate a PDF document in the size A4 from a HTML String.void
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
Set the document title.void
writeDocument
(PdfDocument pdf, String destination) Writes a PDF document (PdfReader) to the given destination.
-
Field Details
-
FEATURE_ID
Identifier for the given feature.- See Also:
-
-
Method Details
-
writeDocument
@API(status=STABLE, since="3.0") void writeDocument(PdfDocument pdf, String destination) throws IOException, FileNotFoundException Writes a PDF document (PdfReader) to the given destination.- Parameters:
pdf
- as PdfReaderdestination
- as String- Throws:
IOException
FileNotFoundException
-
loadDocument
Read a PDF from FILE as PdfReader.- Parameters:
pdfDocument
- as File- Returns:
- pdf as PdfReader
- Throws:
IOException
-
removePage
@API(status=STABLE, since="3.0") PdfDocument removePage(PdfDocument pdf, int... pages) throws IOException 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.- Parameters:
pdf
- as PdfReaderpages
- as int- Returns:
- pdf as PdfReader
- Throws:
IOException
-
renderDocumentFromHtml
@API(status=STABLE, since="3.0") void renderDocumentFromHtml(String file, String htmlTemplate) throws FileNotFoundException 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.- Parameters:
file
- as StringhtmlTemplate
- as String- Throws:
FileNotFoundException
-
setAuthor
Set the author for the document.- Parameters:
author
- as String
-
setKeywords
Set hte keywords for the document.- Parameters:
keywords
- as String
-
setSubject
Set the document subject.- Parameters:
subject
- as String
-
setTitle
Set the document title.- Parameters:
title
- as String
-
getAuthor
Get the author of the document.- Returns:
- author as String
-
getKeywords
Get the document related keywords.- Returns:
- keywords as String
-
getSubject
Get the document subject.- Returns:
- subject as String
-
getTitle
Get the document title.- Returns:
- title as String
-