Interface PDFGenerator
-
public interface PDFGeneratorThis interface is has specifications for PDF generation from different types. The user of this interface will have basic functionalities related to PDF.- Since:
- 1.0.0
- Author:
- Urvil Joshi, Uday Kumar, Neha
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]asPDF(List<BufferedImage> bufferedImages)This method will convert BufferedImage list to Byte Array.OutputStreamgenerate(InputStream htmlStream)Converts HTML obtained from anInputStreamto a PDF written to anOutputStream.OutputStreamgenerate(InputStream dataStream, String resourceLoc)This method will convert InputStream to OutputStream.OutputStreamgenerate(String template)This method will convert process Template as String to outpustStreamvoidgenerate(String templatePath, String outputFilePath, String outputFileName)This method will take input as template file and convert template to PDF and save to the given path with given fileName.byte[]mergePDF(List<URL> pdfLists)This method will merge all the PDF files.OutputStreamsignAndEncryptPDF(byte[] pdf, Rectangle rectangle, String reason, int pageNumber, Provider provider, CertificateEntry<X509Certificate,PrivateKey> certificateEntry, String password)Signs a PDF and protect it with password
-
-
-
Method Detail
-
generate
OutputStream generate(InputStream htmlStream) throws IOException
Converts HTML obtained from anInputStreamto a PDF written to anOutputStream.- Parameters:
htmlStream- the processedTemplate in the form of aInputStream- Returns:
- outpustStream PDF Output Stream (PDF stream)
- Throws:
IOException- Signals that an I/O exception has occurred.
-
generate
OutputStream generate(String template) throws IOException
This method will convert process Template as String to outpustStream- Parameters:
template- the processedTemplate in the form of aString- Returns:
- OutputStream PDF Output Stream (PDF stream)
- Throws:
IOException- Signals that an I/O exception has occurred.
-
generate
void generate(String templatePath, String outputFilePath, String outputFileName) throws IOException
This method will take input as template file and convert template to PDF and save to the given path with given fileName.- Parameters:
templatePath- the processedTemplate in the form of aStringoutputFilePath- Output File PathoutputFileName- Output File Name- Throws:
IOException- Signals that an I/O exception has occurred.
-
generate
OutputStream generate(InputStream dataStream, String resourceLoc) throws IOException
This method will convert InputStream to OutputStream.- Parameters:
dataStream- the processedTemplate in the form of aInputStream.resourceLoc- resourceLoctionString.- Returns:
- outpustStream PDF Output Stream (PDF stream).
- Throws:
IOException- Signals that an I/O exception has occurred.
-
asPDF
byte[] asPDF(List<BufferedImage> bufferedImages) throws IOException
This method will convert BufferedImage list to Byte Array.- Parameters:
bufferedImages- the input image to convert as PDF.- Returns:
- array comprising PDF.
- Throws:
IOException- Signals that an I/O exception has occurred.
-
mergePDF
byte[] mergePDF(List<URL> pdfLists) throws IOException
This method will merge all the PDF files.- Parameters:
pdfLists- the URL list of PDF files.- Returns:
- the byte array comprising merged file.
- Throws:
IOException- Signals that an I/O exception has occurred.
-
signAndEncryptPDF
OutputStream signAndEncryptPDF(byte[] pdf, Rectangle rectangle, String reason, int pageNumber, Provider provider, CertificateEntry<X509Certificate,PrivateKey> certificateEntry, String password) throws IOException, GeneralSecurityException
Signs a PDF and protect it with password- Parameters:
pdf- byte array of pdf.rectangle-Rectangleclass to enclose signingreason- reason of signing.pageNumber- page number of rectangle.provider-Provider.certificateEntry-CertificateEntryclass for certificate and private key as Input;password- password for protecting pdf.- Returns:
OutputStreamof signed PDF.- Throws:
IOException- Signals that an I/O exception has occurred.GeneralSecurityException- Signals general security exception while signing.
-
-