aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java b/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java
index e98c0f1..e1aab03 100644
--- a/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java
+++ b/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java
@@ -65,6 +65,10 @@ import com.google.zxing.Result;
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
import com.google.zxing.common.HybridBinarizer;
+//////
+
+
+
/**
* Extract all relevant information from a placeholder image.
*
@@ -107,7 +111,6 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
throw new PDFDocumentException(ErrorCode.DOCUMENT_CANNOT_BE_READ, e);
}
PDFASUtils.checkDocumentPermissions(doc);
-
SignaturePlaceholderExtractor extractor;
try
{
@@ -130,12 +133,12 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
return ret;
}
} catch (IOException e1) {
- throw new PDFDocumentException(ErrorCode.DOCUMENT_CANNOT_BE_READ, e1);
+ throw new PDFDocumentException(ErrorCode.DOCUMENT_CANNOT_BE_READ, e1);
}
}
if (extractor.placeholders.size() > 0){
- SignaturePlaceholderData ret = matchPlaceholderDocument(extractor.placeholders, placeholderId, matchMode);
+ SignaturePlaceholderData ret = matchPlaceholderDocument(extractor.placeholders, placeholderId, matchMode);
SignaturePlaceholderContext.setSignaturePlaceholderData(ret);
return ret;
}
@@ -199,15 +202,15 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
protected void processOperator( PDFOperator operator, List arguments ) throws IOException
{
- String operation = operator.getOperation();
- if( operation.equals( "Do" ) )
+ String operation = operator.getOperation();
+ if( operation.equals( "Do" ) )
{
- COSName objectName = (COSName)arguments.get( 0 );
+ COSName objectName = (COSName)arguments.get( 0 );
Map xobjects = getResources().getXObjects();
PDXObject xobject = (PDXObject)xobjects.get( objectName.getName() );
if( xobject instanceof PDXObjectImage )
{
- try
+ /*try
{
PDXObjectImage image = (PDXObjectImage)xobject;
SignaturePlaceholderData data = checkImage(image);
@@ -245,12 +248,12 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
catch( NoninvertibleTransformException e )
{
throw new WrappedIOException( e );
- }
+ }*/
}
}
else
{
- super.processOperator( operator, arguments );
+ super.processOperator( operator, arguments );
}
}
@@ -262,7 +265,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
* @throws IOException
*/
private SignaturePlaceholderData checkImage(PDXObjectImage image) throws IOException {
- BufferedImage bimg = image.getRGBImage();
+ BufferedImage bimg = image.getRGBImage();
if (bimg == null) {
String type = image.getSuffix();
if (type != null) {
@@ -283,11 +286,12 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
Result result;
long before = System.currentTimeMillis();
try {
- Hashtable hints = new Hashtable();
+ Hashtable hints = new Hashtable();
Vector formats = new Vector();
formats.add(BarcodeFormat.QR_CODE);
hints.put(DecodeHintType.POSSIBLE_FORMATS, formats);
result = new MultiFormatReader().decode(bitmap, hints);
+
String text = result.getText();
String profile = null;
String type = null;
@@ -297,7 +301,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
if (text.startsWith(Constants.QR_PLACEHOLDER_IDENTIFIER)) {
String[] data = text.split(";");
if (data.length > 1) {
- for (int i = 1; i < data.length; i++) {
+ for (int i = 1; i < data.length; i++) {
String kvPair = data[i];
String[] kv = kvPair.split("=");
if (kv.length != 2) {
@@ -323,6 +327,7 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
}
}
} catch (ReaderException re) {
+ re.printStackTrace();
if (log.isDebugEnabled()) {
log.debug("Could not decode - not a placeholder. needed: "
+ (System.currentTimeMillis() - before));
@@ -341,3 +346,5 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine {
}
}
+
+