@@ -149,6 +149,11 @@ public abstract class PdfAChecker {
149
149
150
150
private boolean fullCheckMode = false ;
151
151
152
+ /**
153
+ * Creates a PdfAChecker with the required conformance level.
154
+ *
155
+ * @param conformanceLevel the required conformance level
156
+ */
152
157
protected PdfAChecker (PdfAConformanceLevel conformanceLevel ) {
153
158
this .conformanceLevel = conformanceLevel ;
154
159
}
@@ -388,33 +393,187 @@ public abstract void checkColor(Color color, PdfDictionary currentColorSpaces, B
388
393
*/
389
394
protected abstract long getMaxNumberOfIndirectObjects ();
390
395
396
+ /**
397
+ * Retrieve forbidden actions in conforming document.
398
+ *
399
+ * @return set of {@link PdfName} with forbidden actions
400
+ */
391
401
protected abstract Set <PdfName > getForbiddenActions ();
402
+
403
+ /**
404
+ * Retrieve allowed actions in conforming document.
405
+ *
406
+ * @return set of {@link PdfName} with allowed named actions
407
+ */
392
408
protected abstract Set <PdfName > getAllowedNamedActions ();
409
+
410
+ /**
411
+ * Checks if the action is allowed.
412
+ *
413
+ * @param action to be checked
414
+ */
393
415
protected abstract void checkAction (PdfDictionary action );
416
+
417
+ /**
418
+ * Verify the conformity of the annotation dictionary.
419
+ *
420
+ * @param annotDic the annotation {@link PdfDictionary} to be checked
421
+ */
394
422
protected abstract void checkAnnotation (PdfDictionary annotDic );
423
+
424
+ /**
425
+ * Checks if entries in catalog dictionary are valid.
426
+ *
427
+ * @param catalogDict the catalog {@link PdfDictionary} to be checked
428
+ */
395
429
protected abstract void checkCatalogValidEntries (PdfDictionary catalogDict );
430
+
431
+ /**
432
+ * Verify the conformity of used color spaces.
433
+ */
396
434
protected abstract void checkColorsUsages ();
435
+
436
+ /**
437
+ * Verify the conformity of the given image.
438
+ *
439
+ * @param image the image to check
440
+ * @param currentColorSpaces the {@link PdfDictionary} containing the color spaces used in the document
441
+ */
397
442
protected abstract void checkImage (PdfStream image , PdfDictionary currentColorSpaces );
443
+
444
+ /**
445
+ * Verify the conformity of the file specification dictionary.
446
+ *
447
+ * @param fileSpec the {@link PdfDictionary} containing file specification to be checked
448
+ */
398
449
protected abstract void checkFileSpec (PdfDictionary fileSpec );
450
+
451
+ /**
452
+ * Verify the conformity of the form dictionary.
453
+ *
454
+ * @param form the form {@link PdfDictionary} to be checked
455
+ */
399
456
protected abstract void checkForm (PdfDictionary form );
457
+
458
+ /**
459
+ * Verify the conformity of the form XObject dictionary.
460
+ *
461
+ * @param form the {@link PdfStream} to check
462
+ */
400
463
protected abstract void checkFormXObject (PdfStream form );
464
+
465
+ /**
466
+ * Performs a number of checks on the logical structure of the document.
467
+ *
468
+ * @param catalog the catalog {@link PdfDictionary} to check
469
+ */
401
470
protected abstract void checkLogicalStructure (PdfDictionary catalog );
471
+
472
+ /**
473
+ * Performs a number of checks on the metadata of the document.
474
+ *
475
+ * @param catalog the catalog {@link PdfDictionary} to check
476
+ */
402
477
protected abstract void checkMetaData (PdfDictionary catalog );
478
+
479
+ /**
480
+ * Verify the conformity of the non-symbolic TrueType font.
481
+ *
482
+ * @param trueTypeFont the {@link PdfTrueTypeFont} to check
483
+ */
403
484
protected abstract void checkNonSymbolicTrueTypeFont (PdfTrueTypeFont trueTypeFont );
485
+
486
+ /**
487
+ * Verify the conformity of the output intents array in the catalog dictionary.
488
+ *
489
+ * @param catalog the {@link PdfDictionary} to check
490
+ */
404
491
protected abstract void checkOutputIntents (PdfDictionary catalog );
492
+
493
+ /**
494
+ * Verify the conformity of the page dictionary.
495
+ *
496
+ * @param page the {@link PdfDictionary} to check
497
+ * @param pageResources the page's resources dictionary
498
+ */
405
499
protected abstract void checkPageObject (PdfDictionary page , PdfDictionary pageResources );
500
+
501
+ /**
502
+ * Checks the allowable size of the page.
503
+ *
504
+ * @param page the {@link PdfDictionary} of page which size being checked
505
+ */
406
506
protected abstract void checkPageSize (PdfDictionary page );
507
+
508
+ /**
509
+ * Verify the conformity of the PDF array.
510
+ *
511
+ * @param array the {@link PdfArray} to check
512
+ */
407
513
protected abstract void checkPdfArray (PdfArray array );
514
+
515
+ /**
516
+ * Verify the conformity of the PDF dictionary.
517
+ *
518
+ * @param dictionary the {@link PdfDictionary} to check
519
+ */
408
520
protected abstract void checkPdfDictionary (PdfDictionary dictionary );
521
+
522
+ /**
523
+ * Verify the conformity of the PDF name.
524
+ *
525
+ * @param name the {@link PdfName} to check
526
+ */
409
527
protected abstract void checkPdfName (PdfName name );
528
+
529
+ /**
530
+ * Verify the conformity of the PDF number.
531
+ *
532
+ * @param number the {@link PdfNumber} to check
533
+ */
410
534
protected abstract void checkPdfNumber (PdfNumber number );
535
+
536
+ /**
537
+ * Verify the conformity of the PDF stream.
538
+ *
539
+ * @param stream the {@link PdfStream} to check
540
+ */
411
541
protected abstract void checkPdfStream (PdfStream stream );
542
+
543
+ /**
544
+ * Verify the conformity of the PDF string.
545
+ *
546
+ * @param string the {@link PdfString} to check
547
+ */
412
548
protected abstract void checkPdfString (PdfString string );
549
+
550
+ /**
551
+ * Verify the conformity of the symbolic TrueType font.
552
+ *
553
+ * @param trueTypeFont the {@link PdfTrueTypeFont} to check
554
+ */
413
555
protected abstract void checkSymbolicTrueTypeFont (PdfTrueTypeFont trueTypeFont );
556
+
557
+ /**
558
+ * Verify the conformity of the trailer dictionary.
559
+ *
560
+ * @param trailer the {@link PdfDictionary} of trailer to check
561
+ */
414
562
protected abstract void checkTrailer (PdfDictionary trailer );
415
- protected abstract void checkPageTransparency (PdfDictionary pageDict , PdfDictionary pageResources );
416
563
564
+ /**
565
+ * Verify the conformity of the page transparency.
566
+ *
567
+ * @param pageDict the {@link PdfDictionary} contains contents for transparency to be checked
568
+ * @param pageResources the {@link PdfDictionary} contains resources for transparency to be checked
569
+ */
570
+ protected abstract void checkPageTransparency (PdfDictionary pageDict , PdfDictionary pageResources );
417
571
572
+ /**
573
+ * Verify the conformity of the resources dictionary.
574
+ *
575
+ * @param resources the {@link PdfDictionary} to be checked
576
+ */
418
577
protected void checkResources (PdfDictionary resources ) {
419
578
if (resources == null )
420
579
return ;
@@ -462,10 +621,23 @@ protected void checkResources(PdfDictionary resources) {
462
621
}
463
622
}
464
623
624
+ /**
625
+ * Checks if the specified flag is set.
626
+ *
627
+ * @param flags a set of flags specifying various characteristics of the PDF object
628
+ * @param flag to be checked
629
+ * @return true if the specified flag is set
630
+ */
465
631
protected static boolean checkFlag (int flags , int flag ) {
466
632
return (flags & flag ) != 0 ;
467
633
}
468
634
635
+ /**
636
+ * Checks conformance level of PDF/A standard.
637
+ *
638
+ * @param conformanceLevel the {@link PdfAConformanceLevel} to be checked
639
+ * @return true if the specified conformanceLevel is <code>a</code> for PDF/A-1, PDF/A-2 or PDF/A-3
640
+ */
469
641
protected static boolean checkStructure (PdfAConformanceLevel conformanceLevel ) {
470
642
return conformanceLevel == PdfAConformanceLevel .PDF_A_1A
471
643
|| conformanceLevel == PdfAConformanceLevel .PDF_A_2A
@@ -484,6 +656,12 @@ protected static boolean isContainsTransparencyGroup(PdfDictionary dictionary) {
484
656
dictionary .getAsDictionary (PdfName .Group ).getAsName (PdfName .S ));
485
657
}
486
658
659
+ /**
660
+ * Checks whether the specified dictionary was already checked.
661
+ *
662
+ * @param dictionary the {@link PdfDictionary} to check
663
+ * @return true if the specified dictionary was checked
664
+ */
487
665
protected boolean isAlreadyChecked (PdfDictionary dictionary ) {
488
666
if (checkedObjects .contains (dictionary )) {
489
667
return true ;
0 commit comments