code: private void validateIfdFP(IFD ifd, int p) {
      IfdTags metadata = ifd.getMetadata();
  
      checkRequiredTag(metadata, "ImageDescription", 1);
      checkRequiredTag(metadata, "StripOffsets", 1);
      if (p == 1 || p == 2) {
        checkRequiredTag(metadata, "StripOffsets", 1, new long[]{0});
      }
      checkRequiredTag(metadata, "NewSubfileType", 1);
      checkRequiredTag(metadata, "ImageLength", 1);
      checkRequiredTag(metadata, "ImageWidth", 1);
      checkRequiredTag(metadata, "StripOffsets", 1);
      if (p == 0) {
        checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
      } else {
        checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
      }
      checkRequiredTag(metadata, "StripBYTECount", 1);
      checkRequiredTag(metadata, "XResolution", 1);
      checkRequiredTag(metadata, "YResolution", 1);
      checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{2});
      if (p == 1 || p == 2) {
        checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
        checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
      }
    }
docs: Validate Final Page.
  
  @param ifd the ifd
  @param p the profile (default = 0, P1 = 1, P2 = 2)