From "Mathematical Analysis" of T.M. Apostol.
a) If $x \ge 2$, prove that $\pi(x)$ and $\vartheta(x)$ can be expressed as the following Riemann-Stieltjes integrals:
\begin{gather*} \vartheta(x)= \int_{\frac{3}2}^x\log{t} \ d\pi(x) \ \ \ \ \ \ \ \pi(x)=\int_{\frac{3}2}^x \frac{1}{\log{t}} \ d \vartheta(t) \end{gather*}
NOTE: The lower limit can be replaced by any number in the open interval $(1, 2)$.
b) If $x \ge 2$, use integration by parts to show that \begin{gather*} \vartheta(x)= \pi(x)\log{x} - \int_2^x\frac{\pi(t)}{\log{t}} \ dt \\ \\ \pi(x)= \frac{\vartheta(x)}{\log{x}} + \int_2^x\frac{\vartheta(t)}{t\log^2{t}} \ dt \end{gather*}
$I(n) = \begin{cases} 1 \ \ \ n \in \mathbb{P} \\ 0 \ \ \ n \notin \mathbb{P} \end{cases}$. Here $\pi(x)=\sum_{p \le x} 1= \sum_{n=1}^{[x]}I(n)$ and $\vartheta(t)=\sum_{p \le x} \log{p}= \sum_{n=1}^{[x]}I(n)\log{n}$.
For every sequence ${a_n}$, let the sum be $A(x)=\sum_{n=1}^{[x]}a_n$ as a step function, by integration by parts the following holds: \begin{gather*} \sum_{n=1}^{[x]}a_nf(n)=A(x)f(x) - \int_1^xA(t)f'(t) \ dt \end{gather*}
Applying this to $\vartheta(x)$ we get \begin{gather*} \vartheta(x)=\pi(x)\log{x} - \int_1^x\frac{\pi(t)}{t} \ dt =\pi(x)\log{x} - \int_1^x \pi(t) \ d\log{t} \end{gather*} where the lower limit can become every number in $[1, 2]$ because the integrand is $0$ in the interior of this interval.
By integration by parts we have \begin{gather*} \int_1^x \pi(t) \ d\log{t} + \int_1^x \log{t} \ d \pi(t)= \pi(x)\log{x} \end{gather*}
From that it follows
\begin{gather*} \vartheta(x)= \int_1^x \log{t} \ d \pi(t) \end{gather*}
the lower limit can become every number in $[1, 2)$ because $\pi(x)$ is a step function without any jump in this interval.
I'm getting struggle with the reverse side starting from $\pi(x)$, i'm looking for the solution of for some hints. Thanks.