First, I tried to use Cloudconvert. It can convert between so many fyletypes, but its PHP API causes memory leaks almost at all times.
The second I tried was Pdfcrowd. It works perfectly, but it can convert only HTML to PDF.
The third I tried was Pdfaid. It works also perfectly, but it can convert only PDF to DOCX.
But the second and the third have conversion limits (Pdfaid has only 20 conversions per API key), which can be extended by paying.
Do you have any experiences with some other PHP APIs or libraries?
According to answers from @Ruchi and @BananaMan, I'll try to use the combination of HTML to docx and dompdf libraries instead of the former combination of Pdfcrowd and Pdfaid limited APIs. Thank you so much for your answers.