public final class PDFUtils
extends java.lang.Object
Class that contains tools to manage of PDF files.
Project:Library for the integration with the services of @Firma, eVisor and TS@.
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
addAttachment(byte[] pdf,
java.util.ArrayList<FileAttachment> attachments)
Adds the supplied attachment list to supplied PDF.
|
static byte[] |
concatPDF(byte[] pdf1,
byte[] pdf2,
java.lang.String identifier1,
java.lang.String identifier2,
java.lang.String rule)
Concatenates the supplied PDF files.
|
static byte[] |
concatPDFs(java.util.List<byte[]> files)
Methods that concatenates the supplied PDF files to a PDF file.
|
static int |
getNumPages(byte[] document)
Gets the page number of a PDF document.
|
static java.util.List<java.lang.String> |
getPagesOrientation(byte[] document)
Gets a List of String that represents the orientation of each page.
|
static byte[] |
imageToPDF(byte[] image)
Method that converts a image file to PDF file.
|
static byte[] |
includePages(byte[] targetPdf,
byte[] originPdf,
MatrixPagesInclude pagesIncl)
Method that creates a PDF file by including a document in another with the specified rules.
|
static boolean |
isPDFFile(byte[] file)
Checks if the supplied document is a PDF document.
|
public static byte[] addAttachment(byte[] pdf,
java.util.ArrayList<FileAttachment> attachments)
throws SignatureReportException
pdf - PDF file.attachments - Attachment files.UtilsException - If an error occurs.SignatureReportExceptionpublic static byte[] concatPDF(byte[] pdf1,
byte[] pdf2,
java.lang.String identifier1,
java.lang.String identifier2,
java.lang.String rule)
throws UtilsException
pdf1 - PDF file.pdf2 - PDF file.identifier1 - Token used to identifies the first input document.identifier2 - Token used to identifies the second input document.rule - Concatenation rule.Ej: $identifier1(1)+ $identifier2(4-6). Concat the page 1 of the first document with the pages 4 to 6 of the second document.UtilsException - If an error occurs.public static boolean isPDFFile(byte[] file)
file - Document to check.public static byte[] includePages(byte[] targetPdf,
byte[] originPdf,
MatrixPagesInclude pagesIncl)
throws UtilsException
targetPdf - Target document.originPdf - Original document.pagesIncl - Rules.UtilsException - If an error occurs.public static int getNumPages(byte[] document)
throws UtilsException
document - PDF document.UtilsException - If an error occurs.public static java.util.List<java.lang.String> getPagesOrientation(byte[] document)
throws UtilsException
document - PDF document.UtilsException - If an error occurs.public static byte[] concatPDFs(java.util.List<byte[]> files)
throws UtilsException
files - List of PDF files.UtilsException - If an error occurs.public static byte[] imageToPDF(byte[] image)
throws UtilsException
image - Image file.UtilsException - If an error occurs.