File tree Expand file tree Collapse file tree 5 files changed +47
-36
lines changed
main/java/org/fugerit/java/doc/val/pdf
test/java/test/org/fugerit/java/doc/val Expand file tree Collapse file tree 5 files changed +47
-36
lines changed Original file line number Diff line number Diff line change 4141 <artifactId >pdfbox</artifactId >
4242 <version >${pdfbox-version} </version >
4343 </dependency >
44+
45+ <dependency >
46+ <groupId >org.apache.poi</groupId >
47+ <artifactId >poi-ooxml</artifactId >
48+ </dependency >
4449
4550 </dependencies >
4651
Original file line number Diff line number Diff line change 11package org .fugerit .java .doc .val .pdf .boc ;
22
3- import java .io .InputStream ;
4-
5- import org .apache .pdfbox .pdmodel .PDDocument ;
6- import org .fugerit .java .doc .val .core .DocTypeValidationResult ;
7- import org .fugerit .java .doc .val .core .DocTypeValidator ;
8- import org .fugerit .java .doc .val .core .basic .AbstractDocTypeValidator ;
9- import org .slf4j .Logger ;
10- import org .slf4j .LoggerFactory ;
11-
12- public class PdfboxValidator extends AbstractDocTypeValidator {
13-
14- private static final Logger logger = LoggerFactory .getLogger ( PdfboxValidator .class );
15-
16- public static final String EXTENSION = "PDF" ;
17-
18- public static final String MIME_TYPE = "application/pdf" ;
19-
20- public static final DocTypeValidator DEFAULT = new PdfboxValidator ();
21-
22- public PdfboxValidator () {
23- super ( MIME_TYPE , EXTENSION );
24- }
25-
26- @ Override
27- public DocTypeValidationResult validate (InputStream is ) {
28- DocTypeValidationResult result = DocTypeValidationResult .newFail ();
29- try {
30- PDDocument .load ( is );
31- result = DocTypeValidationResult .newOk ();
32- } catch (Exception e ) {
33- logger .warn ( "Failed check on pdf : " +e );
34- }
35- return result ;
36- }
3+ @ Deprecated
4+ public class PdfboxValidator extends org .fugerit .java .doc .val .pdf .box .PdfboxValidator {
375
386}
Original file line number Diff line number Diff line change 1+ package org .fugerit .java .doc .val .pdf .box ;
2+
3+ import java .io .InputStream ;
4+
5+ import org .apache .pdfbox .pdmodel .PDDocument ;
6+ import org .fugerit .java .doc .val .core .DocTypeValidationResult ;
7+ import org .fugerit .java .doc .val .core .DocTypeValidator ;
8+ import org .fugerit .java .doc .val .core .basic .AbstractDocTypeValidator ;
9+ import org .slf4j .Logger ;
10+ import org .slf4j .LoggerFactory ;
11+
12+ public class PdfboxValidator extends AbstractDocTypeValidator {
13+
14+ private static final Logger logger = LoggerFactory .getLogger ( PdfboxValidator .class );
15+
16+ public static final String EXTENSION = "PDF" ;
17+
18+ public static final String MIME_TYPE = "application/pdf" ;
19+
20+ public static final DocTypeValidator DEFAULT = new PdfboxValidator ();
21+
22+ public PdfboxValidator () {
23+ super ( MIME_TYPE , EXTENSION );
24+ }
25+
26+ @ Override
27+ public DocTypeValidationResult validate (InputStream is ) {
28+ DocTypeValidationResult result = DocTypeValidationResult .newFail ();
29+ try {
30+ PDDocument .load ( is );
31+ result = DocTypeValidationResult .newOk ();
32+ } catch (Exception e ) {
33+ logger .warn ( "Failed check on pdf : " +e );
34+ }
35+ return result ;
36+ }
37+
38+ }
Original file line number Diff line number Diff line change 22
33import org .fugerit .java .doc .val .core .DocValidatorFacade ;
44import org .fugerit .java .doc .val .core .basic .ImageValidator ;
5- import org .fugerit .java .doc .val .pdf .boc .PdfboxValidator ;
5+ import org .fugerit .java .doc .val .pdf .box .PdfboxValidator ;
66import org .junit .Test ;
77
88public class TestAllFacade extends TestDocValidatorFacade {
Original file line number Diff line number Diff line change 11package test .org .fugerit .java .doc .val ;
22
33import org .fugerit .java .doc .val .core .DocValidatorFacade ;
4- import org .fugerit .java .doc .val .pdf .boc .PdfboxValidator ;
4+ import org .fugerit .java .doc .val .pdf .box .PdfboxValidator ;
55import org .junit .Test ;
66
77public class TestPdfBoxValidator extends TestDocValidatorFacade {
You can’t perform that action at this time.
0 commit comments