I’m trying to convert DOCX files to PDF using JavaScript for a small upload form, but the tables keep shifting. Has anyone managed this while keeping the original layout intact?
JavaScript in the browser usually won’t preserve DOCX layout exactly, especially tables. I’d upload the file to the server and have Word or LibreOffice export it to PDF, with the same fonts installed and page size set correctly. I learned the hard way that missing fonts alone can shift every table.
Tables shifting is the classic docx-to-pdf pain, browsers are terrible at this. I’d skip doing it in JS entirely and run LibreOffice headless on the server instead, it handles tables way better than anything in the browser. Worth a try before you lose a weekend to it. Is this running on a server or purely client side?