|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.knowcenter.wag.egov.egiz.PdfAS
public abstract class PdfAS
This class contains the major methods used by both, the commandline and the webapp, to perform signation and verification.
Field Summary | |
---|---|
static String |
PDF_MIME_TYPE
The Mime Type of a PDF document. |
static float |
SIGNATURE_BORDER
The left/right border. |
static float |
SIGNATURE_MARGIN
The top/bottom border. |
static String |
STRICT_MODE_KEY
The key of the strict mode setting. |
Constructor Summary | |
---|---|
PdfAS()
|
Method Summary | |
---|---|
static PositioningInstruction |
adjustTableAndCalculatePosition(byte[] pdf,
PdfPTable pdf_table)
Sets the width of the table according to the layout of the document and calculates the y position where the PDFPTable should be placed. |
static PositioningInstruction |
adjustTableAndCalculatePositionRegardingFooter(byte[] pdf,
PdfPTable pdf_table,
float footer_line)
Sets the width of the table according to the layout of the document and calculates the y position where the PDFPTable should be placed. |
static void |
applyStrictMode(byte[] pdf)
Applies strict version mode on the PDF and throws an exception, if the pdf is not 1.4. |
static boolean |
checkForSemanticEquality(List found_blocks)
Checks the list of blocks for semantic equality. |
static boolean |
checkFoundRequiredKeys(List found_keys,
boolean old_style)
Checks the found keys for the required keys regarding the old style. |
static boolean |
checkThatOrderIsCorrectAndCorrectFoundKeys(List found_keys,
List profile_keys,
boolean old_style)
Checks that the found keys are in correct order regarding SIG_ID as optional key. |
static boolean |
containsFoundKey(List found_keys,
String key)
|
static PdfPTable |
createPdfPTableFromSignatureObject(SignatureObject signature_object)
Creates the iText PDFPTable from a given SignatureObject. |
static SignatureObject |
createSignatureObjectFromType(String signature_type)
Helper method that creates a SignatureObject and initializes it with the given type. |
static PositioningInstruction |
determineTablePositioning(TablePos pos,
String signature_type,
byte[] pdf,
PdfPTable pdf_table)
Evalutates absolute positioning and prepares the PositioningInstruction for placing the table. |
static String |
extractNormalizedTextTextual(byte[] pdf)
Extracts and normalizes the text from the pdf. |
static String |
extractNormalizedTextTextual(byte[] pdf,
int length)
Extracts and normalizes the text from the pdf. |
static List |
extractSignatureHoldersTextual(String raw_text,
boolean old_style)
Extracts all signature blocks from the given raw text using textual mode. |
static SignatureHolder |
extractSignatureHolderTextual(String raw_text,
boolean old_style)
Extracts the last signature holder from the given text. |
static List |
findBlockInText(String text,
SignatureTypeDefinition sig_type_def,
boolean old_style)
Tries to find a block of the given type in the text. |
static int |
getIndexOfFoundKey(List found_keys,
String key)
|
static boolean |
isPdf14(byte[] pdf)
Checks the version of the given PDF to be 1.4 or lower. |
static boolean |
isStrictPdfChecking()
Tells, if strict PDF checking the PDF version is enabled. |
static String |
normalizeText(String text)
Normalizes the given text. |
static TablePos |
parsePositionFromPosString(String pos_string)
Parses the TablePos object from a given String with the appropriate format. |
static PdfReader |
readInPdfDocument(byte[] pdf)
Creates an iText Reader that parses the document. |
static SignResult |
sign(PdfASID algorithm,
byte[] pdf,
String signature_type,
String connector,
String user_name,
String user_password,
TablePos pos)
Signs the document using the given algorithm. |
static SignatureObject |
sign(String text_to_sign,
String signature_type,
String connector,
String user_name,
String user_password)
Signs the given text with the provided connector using the given signature type. |
static void |
sortFoundKeysAscendingly(List found_keys)
Sorts the FoundKeys List ascendingly according to the start indices of the found keys (the first found key in the list will have the lowest start index, the second one the second lowest and so forth). |
static void |
sortFoundKeysDescendingly(List found_keys)
Sorts the FoundKeys List descendingly according to the start indices of the found keys (the first found key in the list will have the highest start index, the second one the second highest and so forth). |
static List |
sortOutEarlyBlocks(List found_blocks)
Sorts out early blocks and leaves only those at the bottom of the text. |
static List |
sortOutLargeBlocks(List found_blocks)
Sorts out large blocks. |
static SignatureResponse |
verify(SignatureHolder signature_holder,
String connector)
Verifies a SignatureHolder using the given connector. |
static List |
verifyPdf(byte[] pdf,
String connector)
Verifies the given PDF document. |
static List |
verifySignatureHolders(List signature_holders,
String connector)
Verifies the List of SignatureHolders using the given connector. |
static List |
verifyText(String text,
String connector)
Verifies the given text that is supposed to be extracted from a PDF document using text extraction mechanisms. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String STRICT_MODE_KEY
public static final float SIGNATURE_BORDER
public static final float SIGNATURE_MARGIN
public static final String PDF_MIME_TYPE
Constructor Detail |
---|
public PdfAS()
Method Detail |
---|
public static boolean isStrictPdfChecking()
public static boolean isPdf14(byte[] pdf) throws PDFDocumentException
pdf
- The PDF.
PDFDocumentException
- Forwarded exception.public static void applyStrictMode(byte[] pdf) throws PDFDocumentException
Furthermore (independently of strict mode) the PDF is checked for parsability.
pdf
- The pdf to be checked against strict mode.
PDFDocumentException
public static List verifyPdf(byte[] pdf, String connector) throws PresentableException
pdf
- The PDF document.connector
- The connector.
PresentableException
- Forwarded exception.public static List verifyText(String text, String connector) throws PresentableException
text
- The text to be verified.connector
- The connecor.
PresentableException
- Forwarded exception.public static List extractSignatureHoldersTextual(String raw_text, boolean old_style) throws PDFDocumentException, SignatureException, SignatureTypesException, NormalizeException
raw_text
- The raw text.
PDFDocumentException
- F.e.
SignatureException
- F.e.
SignatureTypesException
NormalizeException
public static SignatureHolder extractSignatureHolderTextual(String raw_text, boolean old_style) throws SignatureException, SignatureTypesException, NormalizeException
raw_text
- old_style
-
SignatureException
SignatureTypesException
NormalizeException
public static List findBlockInText(String text, SignatureTypeDefinition sig_type_def, boolean old_style)
text
- The text.sig_type_def
- The type of the block.old_style
- Tells, if the block is old style (SIG_KZ will be ignored), or if
it is a new block.
public static void sortFoundKeysDescendingly(List found_keys)
found_keys
- The List of FoundKey objects to be sorted.public static void sortFoundKeysAscendingly(List found_keys)
found_keys
- The List of FoundKey objects to be sorted.public static boolean checkThatOrderIsCorrectAndCorrectFoundKeys(List found_keys, List profile_keys, boolean old_style)
If the SIG_ID key is misplaced, it will be removed from the found keys list.
found_keys
- The found keys ordered descendingly to their start positionprofile_keys
- The profile keys.old_style
- Tells, if SIG_KZ should be ignored, or not.
public static List sortOutEarlyBlocks(List found_blocks)
found_blocks
- The found blocks.
public static List sortOutLargeBlocks(List found_blocks)
found_blocks
- The found blocks.
public static boolean checkForSemanticEquality(List found_blocks)
found_blocks
- The list of found blocks.
public static int getIndexOfFoundKey(List found_keys, String key)
public static boolean containsFoundKey(List found_keys, String key)
public static boolean checkFoundRequiredKeys(List found_keys, boolean old_style)
found_keys
- The found keys.old_style
- Flag that tells, if KZ is not required.
public static List verifySignatureHolders(List signature_holders, String connector) throws PDFDocumentException, NormalizeException, SignatureException
signature_holders
- The List of SignatureHolder objects to be verified.connector
- The connector.
PDFDocumentException
- F.e.
NormalizeException
- F.e.
SignatureException
- F.e.public static SignatureResponse verify(SignatureHolder signature_holder, String connector) throws NormalizeException, PDFDocumentException, SignatureException
signature_holder
- The SignatureHolder to be verified.connector
- The connector.
NormalizeException
- F.e.
PDFDocumentException
- F.e.
SignatureException
- F.e.public static SignatureObject sign(String text_to_sign, String signature_type, String connector, String user_name, String user_password) throws SignatureException, PDFDocumentException
text_to_sign
- The text String to be signed.signature_type
- The type of the signature.connector
- The connector.user_name
- The user name.user_password
- The user password.
SignatureException
- F.e.
PDFDocumentException
- F.e.public static SignatureObject createSignatureObjectFromType(String signature_type) throws SignatureException, SignatureTypesException
signature_type
- The type.
SignatureException
- f.e.
SignatureTypesException
- f.e.public static SignResult sign(PdfASID algorithm, byte[] pdf, String signature_type, String connector, String user_name, String user_password, TablePos pos) throws PresentableException
algorithm
- The Signator algorithm to be used.pdf
- The PDF.signature_type
- The signature type.connector
- The connector.user_name
- The user name.user_password
- The password.pos
- The absolute position. If null, the position is either taken from
the profile or computed automatically.
PresentableException
- F.e.public static String extractNormalizedTextTextual(byte[] pdf) throws PresentableException
pdf
- The PDF document.
PresentableException
- F.e.public static String extractNormalizedTextTextual(byte[] pdf, int length) throws PresentableException
pdf
- The PDF document.length
- The length of the PDF document. The decument is considered to be
that long even if the byte array is longer.
PresentableException
- F.e.public static String normalizeText(String text) throws NormalizeException
text
- The text to be normalized.
NormalizeException
- F.e.public static PdfPTable createPdfPTableFromSignatureObject(SignatureObject signature_object) throws PDFDocumentException, SignatureException
signature_object
- The SignatureObject.
PDFDocumentException
- F.e.
SignatureException
- F.e.public static PositioningInstruction determineTablePositioning(TablePos pos, String signature_type, byte[] pdf, PdfPTable pdf_table) throws PDFDocumentException, SettingsException
pos
- The absolute positioning parameter. If null it is sought in the
profile definition.signature_type
- The profile definition of the table to be written.pdf
- The pdf.pdf_table
- The pdf table to be written.
PDFDocumentException
- F.e.
SettingsException
- F.e.public static PositioningInstruction adjustTableAndCalculatePosition(byte[] pdf, PdfPTable pdf_table) throws PDFDocumentException
pdf
- The PDF document.pdf_table
- The PDFPTable to be placed.
PDFDocumentException
- F.e.public static PositioningInstruction adjustTableAndCalculatePositionRegardingFooter(byte[] pdf, PdfPTable pdf_table, float footer_line) throws PDFDocumentException
This algorithm tries to position the table between the end of the text and the footer line.
pdf
- The PDF document.pdf_table
- The PDFPTable to be placed.
PDFDocumentException
- F.e.public static PdfReader readInPdfDocument(byte[] pdf) throws PDFDocumentException
This is a convenience function for wrapping the Reader's exceptions into PDFDocumentException.
pdf
- The PDF document.
PDFDocumentException
- F.e.public static TablePos parsePositionFromPosString(String pos_string) throws PDFDocumentException
pos_string
- The pos string. e.g. 1;40.0;600.0;300.0
PDFDocumentException
- Thrown, if the String doesn't have the proper format.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |