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.Return the used paper fromat dimension. the default size is A4 with a margin of 20 millimeter.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.voidrenderDocumentFromHtml(String file, String htmlTemplate) Generate a PDF document in the size A4 from a HTML String.voidSet the author for the document.voidChange the default papersize format fom A4 to a cutom value.
(width / height) size: 21cm 29.7cm; margin: 20mm 20mm;voidsetKeywords(String keywords) Set hte keywords for the document.voidsetSubject(String subject) Set the document subject.voidSet the document title.voidwriteDocument(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- case of errorFileNotFoundException- case of error
-
loadDocument
Read a PDF from FILE as PdfReader.- Parameters:
pdfDocument- as File- Returns:
- pdf as PdfReader
- Throws:
IOException- case of error
-
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- case of error
-
renderDocumentFromHtml
@API(status=STABLE, since="3.0") void renderDocumentFromHtml(String file, String htmlTemplate) throws FileNotFoundException, IOException 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- case of errorIOException
-
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
-
setFormat
Change the default papersize format fom A4 to a cutom value.
(width / height) size: 21cm 29.7cm; margin: 20mm 20mm;- Parameters:
format- 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
-
getFormat
Return the used paper fromat dimension. the default size is A4 with a margin of 20 millimeter.- Returns:
- format as String
-