All of the digits of a seven-digit positive integer are either $7$ or $8.$ If this integer is divisible by $9,$ what is the sum of its digits?
1. Let the seven-digit number be composed of $x$ digits of $7$ and $y$ digits of $8$. Therefore, we have the equation:
   \[
   x + y = 7
   \]

2. For the number to be divisible by $9$, the sum of its digits must be divisible by $9$. The sum of the digits can be expressed as:
   \[
   7x + 8y
   \]

3. We need to find $x$ and $y$ such that:
   \[
   7x + 8y \equiv 0 \pmod{9}
   \]

4. Notice that:
   \[
   7 \equiv -2 \pmod{9} \quad \text{and} \quad 8 \equiv -1 \pmod{9}
   \]

5. Substituting these congruences, we get:
   \[
   7x + 8y \equiv -2x - y \pmod{9}
   \]

6. For the sum to be divisible by $9$, we need:
   \[
   -2x - y \equiv 0 \pmod{9}
   \]

7. Simplifying, we get:
   \[
   2x + y \equiv 0 \pmod{9}
   \]

8. We also know from the first equation that:
   \[
   x + y = 7
   \]

9. Solving these two equations simultaneously:
   \[
   \begin{cases}
   2x + y \equiv 0 \pmod{9} \\
   x + y = 7
   \end{cases}
   \]

10. From the second equation, we can express $y$ in terms of $x$:
    \[
    y = 7 - x
    \]

11. Substituting $y = 7 - x$ into the first equation:
    \[
    2x + (7 - x) \equiv 0 \pmod{9}
    \]

12. Simplifying, we get:
    \[
    x + 7 \equiv 0 \pmod{9}
    \]

13. Therefore:
    \[
    x \equiv -7 \pmod{9} \quad \text{or} \quad x \equiv 2 \pmod{9}
    \]

14. Since $x$ must be a non-negative integer less than or equal to $7$, we have:
    \[
    x = 2
    \]

15. Substituting $x = 2$ back into $x + y = 7$:
    \[
    2 + y = 7 \implies y = 5
    \]

16. The sum of the digits is:
    \[
    7x + 8y = 7(2) + 8(5) = 14 + 40 = 54
    \]

Conclusion:
\[
\boxed{54}
\]