1 Reader

Class Ax.pdf.Reader


Wrapper for iText PDF reader functions TODO: replace by https://github.com/LibrePDF/OpenPDF compile group: 'com.github.librepdf', name: 'openpdf', version: '1.2.10'

Constructor Summary

MethodDescription
JSPDFReader(Object object)
JSPDFReader(Object object, String password)

Method Summary

Modifier and TypeMethodDescription
byte[] addWatermark(Consumer<PdfWatermarkOptions> configurator)
byte[] asBytes()
String getBitmapFromPage(int page)Extracts the bit map from PDF page
String getBitmapFromPage(int page, boolean debug)Extracts the bit map from PDF page
ArrayList getImages()Returns the array of images from PDF document
int getNumberOfImages()
int getNumberOfPages()
byte[] getPreviewFromPage(int pageNum)
ArrayList getTextFromDocument()Extracts the text from PDF document
ArrayList getTextFromDocument(boolean debug)Extracts the text from PDF document
String getTextFromPage(int page)Extracts the text from PDF page (starts at 1) Loop is: for (var page = 1; page
String getTextFromPage(int page, boolean debug)Extracts the text from PDF page
JSPDFReader insertPage(int position)Insert a blank page at given position
boolean isImageOnly()
JSPDFReader join(JSPDFReader other)Joins two pdfs
JSPDFReader remove(int[] pagesToRemove)
JSPDFReader rotate(int page, double angle)
JSPDFReader slice(int startPage, int endPage)
List split(int size)Splits the PDF into a multiple fragments of given size
JDBCBlob toBlob()

Method Detail

JSPDFReader

 JSPDFReader(Object object)
Parameters:
object - 

JSPDFReader

 JSPDFReader(Object object, String password)
Parameters:
object - 
password - 

addWatermark

byte[] addWatermark(Consumer<PdfWatermarkOptions> configurator)
Parameters:
configurator - 
Returns:

asBytes

byte[] asBytes()
Returns:

getBitmapFromPage

                        String getBitmapFromPage(int page)
Info:
Extracts the bit map from PDF page
Parameters:
page - 
Returns:

getBitmapFromPage

                        String getBitmapFromPage(int page, boolean debug)
Info:
Extracts the bit map from PDF page
Parameters:
page - 
debug - 
Returns:

getImages

                        ArrayList getImages()
Info:
Returns the array of images from PDF document
Returns:

getNumberOfImages

int getNumberOfImages()
Returns:
the number of images in PDF document

getNumberOfPages

int getNumberOfPages()
Returns:
the number of pages in PDF document (starts at 1)

getPreviewFromPage

byte[] getPreviewFromPage(int pageNum)
Parameters:
pageNum - 
Returns:

getTextFromDocument

                        ArrayList getTextFromDocument()
Info:
Extracts the text from PDF document
Returns:

getTextFromDocument

                        ArrayList getTextFromDocument(boolean debug)
Info:
Extracts the text from PDF document
Parameters:
debug - 
Returns:

getTextFromPage

                        String getTextFromPage(int page)
Info:
Extracts the text from PDF page (starts at 1) Loop is: for (var page = 1; page
Parameters:
page - 
Returns:

getTextFromPage

                        String getTextFromPage(int page, boolean debug)
Info:
Extracts the text from PDF page
Parameters:
page - 
debug - 
Returns:

insertPage

                        JSPDFReader insertPage(int position)
Info:
Insert a blank page at given position
Parameters:
position - 
Returns:

isImageOnly

boolean isImageOnly()
Returns:
true if pdf has no text layer, so it's an image

join

                        JSPDFReader join(JSPDFReader other)
Info:
Joins two pdfs
Parameters:
other - 
Returns:

remove

                        JSPDFReader remove(int[] pagesToRemove)
Parameters:
pagesToRemove - 
Returns:

rotate

                        JSPDFReader rotate(int page, double angle)
Parameters:
page - 
angle - 
Returns:

slice

                        JSPDFReader slice(int startPage, int endPage)
Parameters:
startPage - 
endPage - 
Returns:

split

                        List split(int size)
Info:
Splits the PDF into a multiple fragments of given size
Parameters:
size - 
Returns:

toBlob

                        JDBCBlob toBlob()
Returns:
the PDF document as a Blob

2 Writer

Class Ax.pdf.Writer


TODO:

Constructor Summary

MethodDescription
JSPDFWriter()

Method Summary

Modifier and TypeMethodDescription
void close()
JDBCBlob toBlob()

Method Detail

JSPDFWriter

 JSPDFWriter()

close

void close()

toBlob

                        JDBCBlob toBlob()
Returns:
the PDF document as a Blob

3 Signer

Class Ax.pdf.Signer


Wrapper for iText PDF reader functions TODO: replace by https://github.com/LibrePDF/OpenPDF compile group: 'com.github.librepdf', name: 'openpdf', version: '1.2.10'

Constructor Summary

MethodDescription
JSPDFSigner(Object object)

Method Summary

Modifier and TypeMethodDescription
byte[] addLtvNoTS(com.itextpdf.text.pdf.security.OcspClient ocsp, com.itextpdf.text.pdf.security.CrlClient crl)https://stackoverflow.
boolean checkCertificateValidity(X509Certificate cert, Date signDate)TODO: move to crypto ??? TODO: move to crypto ??? TODO: move to crypto ???
boolean checkRevocation(com.itextpdf.text.pdf.security.PdfPKCS7 pkcs7, X509Certificate signCert, X509Certificate issuerCert, Date date)
Certificate[] getCertificateChain()
Date getSignDate()
byte[] sign(KeyStore ks, String alias, String password, Consumer<PDFSignOptions> configurator)
HashMap verify()

Method Detail

JSPDFSigner

 JSPDFSigner(Object object)
Parameters:
object - 

addLtvNoTS

byte[] addLtvNoTS(com.itextpdf.text.pdf.security.OcspClient ocsp, com.itextpdf.text.pdf.security.CrlClient crl)
Info:
https://stackoverflow.com/questions/27892960/how-to-enable-ltv-for-a-timestamp-signature/27906587#27906587 This code identifies the most recently filled signature field of the PDF and checks whether it is a document time stamp or an usual signature. If it is a document time stamp, the code adds validation information only for this document timestamp. Otherwise the code adds validation information for all signatures. (The assumed work flow behind this is that the document is signed (for certification and/or approval) a number of times first, and then the document enters LTV cycles adding validation information and document time stamps but no usual signatures anymore. Your work flow may vary and, therefore, your program logic, too.) Only after all this is done, a new document time stamp is added. For this finally added time stamp no validation information are explicitly added to the PDF (if document time stamps from the same TSA have been applied in short succession, validation information included for a prior time stamp may be applicable). And this is why Adobe Reader/Acrobat usually does not consider this document time stamp LTV enabled.
Parameters:
ocsp - Interface for the OCSP Client
crl - Interface that needs to be implemented if you want to embed Certificate Revocation Lists into your PDF.
Returns:

checkCertificateValidity

boolean checkCertificateValidity(X509Certificate cert, Date signDate)
Info:
TODO: move to crypto ??? TODO: move to crypto ??? TODO: move to crypto ???
Parameters:
cert - 
signDate - 
Returns:

checkRevocation

boolean checkRevocation(com.itextpdf.text.pdf.security.PdfPKCS7 pkcs7, X509Certificate signCert, X509Certificate issuerCert, Date date)
Parameters:
pkcs7 - 
signCert - 
issuerCert - 
date - 
Returns:

getCertificateChain

                        Certificate[] getCertificateChain()
Returns:

getSignDate

                        Date getSignDate()
Returns:

sign

byte[] sign(KeyStore ks, String alias, String password, Consumer<PDFSignOptions> configurator)
Parameters:
ks - 
alias - 
password - 
configurator - 
Returns:

verify

                        HashMap verify()
Returns:

4 Form

Class Ax.pdf.Form


PDFBox https://daedtech.com/programatically-filling-out-pdfs-in-java/ There are two posibilities: 1) You have a dynamic XFA form (from Livecycle Designer). You'll have to use the XfaForm object from AcroFields to inspect the fields. 2) In rare forms, fields are added to the pages, but not to the document-level field array that AcroFields checks. It would appear that this is "syntactically valid", just wildly unhelpful... "rude" even. iText doesn't currently go looking for missing fields on a page-by-page basis, though it could be modified to do so.

Constructor Summary

MethodDescription
JSPDFForm(Object object)
JSPDFForm(com.itextpdf.text.pdf.PdfReader doc, ByteArrayOutputStream out)

Method Summary

Modifier and TypeMethodDescription
int getFieldType(String fieldName)
String getFieldValue(String fieldName)
String[] getFields()
void setFieldProperty(String fieldName, String key, Object value)
void setFieldValue(String fieldName, String value)
JDBCBlob toBlob()
JSPDFReader toPDF()

Method Detail

JSPDFForm

 JSPDFForm(Object object)
Parameters:
object - 

JSPDFForm

 JSPDFForm(com.itextpdf.text.pdf.PdfReader doc, ByteArrayOutputStream out)
Parameters:
doc - 
out - 

getFieldType

int getFieldType(String fieldName)
Parameters:
fieldName - 
Returns:

getFieldValue

                        String getFieldValue(String fieldName)
Parameters:
fieldName - 
Returns:

getFields

                        String[] getFields()
Returns:

setFieldProperty

void setFieldProperty(String fieldName, String key, Object value)
Parameters:
fieldName - 
key - 
value - 

setFieldValue

void setFieldValue(String fieldName, String value)
Parameters:
fieldName - 
value - 

toBlob

                        JDBCBlob toBlob()
Returns:

toPDF

                        JSPDFReader toPDF()
Returns: