Modifying PDF content and preserving its format

Hey Community, Is it possible to edit a pdf file while preserving its format. I want to add a few things to my pdf that comes directly from chat gpt. I could convert the pdf into text format and modify the text but I cannot convert it back to a pdf with the same formatting. Could someone help me with this?