Suppose $f:\mathbb R \to \mathbb R$ be a Schwartz function. Then the Hilbert transform $Hf\in L^1(\mathbb R)$ iff $\int_{\mathbb R} f(x) \mathrm dx=0$.
I could prove $Hf\in L^1(\mathbb R)$ implies $\int_{\mathbb R} f(x) \mathrm dx=0$ using the fact $\lim_{|x|\to \infty}xHf(x)=\frac{1}{\pi}\int_{\mathbb R}f(x)\mathrm dx$.
But I couldn't prove the converse, please help.
Context (from comments): I have seen Integrability of the Hilbert transform of a Schwartz function but I couldn't undestand how it is done there. I had seen that before posting the question
Mild elaboration of linked post: Let $A\lesssim B$ mean that $|A|\le C B$. For $x<-1$,
$$g(x):=\int_{-\infty}^xf(t)dt = \int_{-\infty}^x \langle t\rangle ^{-N} \langle t\rangle ^Nf(t) \ dt\ dx \lesssim_{N} \int_{-\infty}^x\langle t\rangle ^{-N} dt \lesssim_N \langle x\rangle^{-N+1} $$ The condition $\int_{-\infty}^\infty f(t)dt = 0$ lets you prove this also for $x>1$ (and of course there is no issue near $x=0$.) So $g$ is Schwartz. Then
$$Hf(x) =\int_{|t|<1} \frac{f(x-t)-f(x)}tdt + \int_{|t|>1} \frac{f(x-t)}t dt =: I_1+I_2,$$ with $$ I_2 =\int_{|t|>1} \frac{f(x-t)}t dt = -\int_{|t|>1} \frac{d}{dt}(g(x-t))\frac{dt}t=g(x-1)-g(x+1) -\int_{|t|>1} \frac{g(x-t)}{t^2} dt$$ so that $$ \|I_2\|_{L^1} \le 2\|g\|_{L^1} + \int_{|t|>1} \frac{\|g\|_{L^1}}{t^2} dt<\infty.$$ For $I_1$, let $I(x,t)$ denote whichever of $[x-t,x]$ or $[x,x-t]$ that is not empty, then $$ |I_1| \le \int_{|t|<1}\frac1t\int_{x-t}^x |f'(r)|dr \le \int_{|t|<1} \max_{r\in I(x,t)}|f'(r)| dt \lesssim \max_{r\in [x-1,x+1]}|f'(r)| $$ and $$f'(r) \lesssim_N \langle r\rangle^{-N}$$ giving $\|I_1\|_{L^1}<\infty$ too; thus $\|Hf\|_{L^1}<\infty$.