1. Project Clover database Wed Jan 17 2024 23:40:18 CST
  2. Package org.europa.together.business

File PdfRenderer.java

 

Code metrics

0
0
0
1
144
42
0
-
-
0
-

Classes

Class Line # Actions
PdfRenderer 20 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package org.europa.together.business;
2   
3    import java.io.File;
4    import java.io.FileNotFoundException;
5    import java.io.IOException;
6    import org.apiguardian.api.API;
7    import static org.apiguardian.api.API.Status.STABLE;
8    import org.europa.together.application.internal.PdfDocument;
9    import org.springframework.stereotype.Component;
10   
11    /**
12    * Basic PDF functionality to generate from an application letters or reports.
13    *
14    * @author elmar.dott@gmail.com
15    * @version 1.2
16    * @since 1.0
17    */
18    @API(status = STABLE, since = "1.0", consumers = "OpenPdfRenderer")
19    @Component
 
20    public interface PdfRenderer {
21   
22    /**
23    * Identifier for the given feature.
24    */
25    @API(status = STABLE, since = "2.0")
26    String FEATURE_ID = "CM-0011";
27   
28    /**
29    * Writes a PDF document (PdfReader) to the given destination.
30    *
31    * @param pdf as PdfReader
32    * @param destination as String
33    * @throws java.io.IOException
34    * @throws java.io.FileNotFoundException
35    */
36    @API(status = STABLE, since = "3.0")
37    void writeDocument(PdfDocument pdf, String destination)
38    throws IOException, FileNotFoundException;
39   
40    /**
41    * Read a PDF from FILE as PdfReader.
42    *
43    * @param pdfDocument as File
44    * @return pdf as PdfReader
45    * @throws java.io.IOException
46    */
47    @API(status = STABLE, since = "3.0")
48    PdfDocument loadDocument(File pdfDocument)
49    throws IOException;
50   
51    /**
52    * Remove from a given PDF pages. Usage:<br>
53    * <code>
54    * PdfReader pdf = readDocument(new File(document.pdf));
55    * File newPdf = removePages(pdf, 2, 4, 12);
56    * </code><br>
57    * Removes from the PDF document the pages: 2,4 and 12.
58    *
59    * @param pdf as PdfReader
60    * @param pages as int
61    * @return pdf as PdfReader
62    * @throws java.io.IOException
63    */
64    @API(status = STABLE, since = "3.0")
65    PdfDocument removePage(PdfDocument pdf, int... pages)
66    throws IOException;
67   
68    /**
69    * Generate a PDF document in the size A4 from a HTML String. The file
70    * parameter define the path were the PDF will sored an how the document is
71    * named.
72    *
73    * @param file as String
74    * @param htmlTemplate as String
75    * @throws java.io.FileNotFoundException
76    */
77    @API(status = STABLE, since = "3.0")
78    void renderDocumentFromHtml(String file, String htmlTemplate)
79    throws FileNotFoundException;
80   
81    /**
82    * Set the author for the document.
83    *
84    * @param author as String
85    */
86    @API(status = STABLE, since = "1.0")
87    void setAuthor(String author);
88   
89    /**
90    * Set hte keywords for the document.
91    *
92    * @param keywords as String
93    */
94    @API(status = STABLE, since = "1.0")
95    void setKeywords(String keywords);
96   
97    /**
98    * Set the document subject.
99    *
100    * @param subject as String
101    */
102    @API(status = STABLE, since = "1.0")
103    void setSubject(String subject);
104   
105    /**
106    * Set the document title.
107    *
108    * @param title as String
109    */
110    @API(status = STABLE, since = "1.0")
111    void setTitle(String title);
112   
113    /**
114    * Get the author of the document.
115    *
116    * @return author as String
117    */
118    @API(status = STABLE, since = "1.0")
119    String getAuthor();
120   
121    /**
122    * Get the document related keywords.
123    *
124    * @return keywords as String
125    */
126    @API(status = STABLE, since = "1.0")
127    String getKeywords();
128   
129    /**
130    * Get the document subject.
131    *
132    * @return subject as String
133    */
134    @API(status = STABLE, since = "1.0")
135    String getSubject();
136   
137    /**
138    * Get the document title.
139    *
140    * @return title as String
141    */
142    @API(status = STABLE, since = "1.0")
143    String getTitle();
144    }