I presume you know that, with gravity as the only acceleration, g, starting with initial speed v, at angle $\displaystyle \theta$ to the horizontal, the (x, y) position after time t is given by $\displaystyle x= vcos(\theta) t$ and $\displaystyle y= vsin(\theta) t (g/2)t^2$.
So if the final height is $\displaystyle y= vsin(\theta) t (g/2)t^2= H$ and the total distance is $\displaystyle x= vcos(\theta) t= D$, with height, H, distance, D, and initial speed, v, given, those are two equations to solve for t and $\displaystyle \theta$.
I would start by eliminating $\displaystyle \theta$. A clever way to do that is to use the fact that $\displaystyle sin^2(\theta)+ cos^2(\theta)= 1$ for all $\displaystyle \theta$:
From the x equation, $\displaystyle v^2cos^2(\theta)t^2= D^2$.
We can write the y equation $\displaystyle v sin(\theta) t= H+ (g/2)t^2$
so $\displaystyle v^2 sin^2(\theta)= (H+ (g/2)t^2)^2$.
Adding those equations, $\displaystyle v^2 t^2= D^2+ (H+ (g/2)t^2)^2= D^2+ H^2+ gHt^2+ (g^2/4)t^4$ of $\displaystyle (g^2/4)t^4+ (gH v^2)t^2+ H^2+ D^2= 0$ which is a quadratic equation in $\displaystyle t^2$
