private String convertHeaderText(String s) {
    StringBuilder result = new StringBuilder();
    int start = 0;
    boolean isExpression = false;
    for (int i = 0; i < s.length(); i++) {
      char c = s.charAt(i);
      if (c == '$') {
        String token = s.substring(start, i);
        if (isExpression) {
          switch (token) {
            case HEADER_TOKEN_PAGE -> result.append(myPageIndex + 1);
            case HEADER_TOKEN_TOTALPAGES -> result.append(myNumberOfPages);
            case HEADER_TOKEN_FILE -> result.append(myFullFileName);
            case HEADER_TOKEN_FILENAME -> result.append(myShortFileName);
            case HEADER_TOKEN_DATE -> result.append(myPrintDate);
            case HEADER_TOKEN_TIME -> result.append(myPrintTime);
          }
        } else {
          result.append(token);
        }
        isExpression = !isExpression;
        start = i + 1;
      }
    }
    if (!isExpression && start < s.length()) {
      result.append(s.substring(start));
    }
    return result.toString();
  }
private String convertHeaderText(String s)