aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv/egiz/pdfas
diff options
context:
space:
mode:
authorrpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-08-30 12:47:02 +0000
committerrpiazzi <rpiazzi@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-08-30 12:47:02 +0000
commitd1f104faf9596c9b5b4c5f776e400c30edc2b4ce (patch)
tree1ee8074d0d946756601439960eae057193481459 /src/main/java/at/gv/egiz/pdfas
parente45125d5f3bab6eb2dbbb581ad7bac9c317ca10f (diff)
downloadpdf-as-3-d1f104faf9596c9b5b4c5f776e400c30edc2b4ce.tar.gz
pdf-as-3-d1f104faf9596c9b5b4c5f776e400c30edc2b4ce.tar.bz2
pdf-as-3-d1f104faf9596c9b5b4c5f776e400c30edc2b4ce.zip
Searching for a QR-Code-Placeholder-Image was commented out, because it made trouble with some documents
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@798 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/gv/egiz/pdfas')
-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 {
}
}
+
+