Dynamic host and PDF alignment

Hello everybody.
I have recently installed ERPnext on a virtual machine in a local server running 24h.
Since I don’t have a static IP address, I have connected my server IP’s to NO-IP host in order I can reach the server remotely.
The problem is that while working on localhost:port the PDF files generated is the correct format, when I use the dynamic host name given by NO-IP the ERP works fine but the PDF generated has uncorrect layout (all in the left).
I have read all your posts about uncorrect alignment of PDF and I have already done some tests modifying the config.json .
I have tried different ways but the system only works correctly if I specify the complete http://(external IP):port address in that precise moment.
Naturally, since I don’t have a static IP address, it’s not possible for me to update continuously the IP:port so how can I solve this issue?
Thank you