How to Fix Lost Fixed-Width Formatting When Converting HTML to PDF
Question details
The user needs to maintain fixed-width fonts and column alignments when converting HTML or plain text documents into a PDF.

- Product
- PDF Converter / Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Converting HTML or plain-text reports to PDF formats.
- Observed behavior
- During conversion, fixed-width fonts like Courier are being replaced by proportional fonts, causing text columns and report formatting to shift out of alignment.
Verify that your source HTML properly utilizes <pre> tags or explicitly defines inline CSS for monospace fonts (e.g., font-family: monospace) to help the converter identify the intended layout.
Use the 'Create a PDF from Web Page' Option
Bypass the standard HTML document conversion by treating the source file as a webpage, which utilizes a different rendering engine.
PDF conversion software often features multiple ways to handle web files. Treating the file as a web page rather than a raw HTML document ensures the software renders the layout exactly as a web browser would.
Open your PDF software. Instead of clicking 'Convert HTML Document', navigate to the tools menu and select the 'Create a PDF from Web Page' option.
In the dialog box that appears, browse for your local HTML or plain-text file instead of typing a URL.
Run the conversion process. This engine correctly interprets <pre> tags and preserves fixed-width font formatting.

Print the Source File to a PDF Printer
Use your operating system's built-in Print to PDF functionality as a reliable workaround to preserve formatting.
Verify Software Version for Conversion Bugs
Check if your specific version of Acrobat DC or your PDF editor has a known bug affecting <pre> tag rendering.
Convert Web Pages and Text to PDF Flawlessly with WPS Office
WPS Office provides robust PDF and document conversion tools that accurately preserve your original formatting. By using WPS Writer's built-in export features, you can securely handle HTML, text, and office files without losing columns or fixed-width layouts.
- 1. Open your file: Launch WPS Office and open your HTML or plain-text document directly in WPS Writer.
- 2. Access the export tool: Go to the 'Menu' button in the top left corner and select 'Export to PDF'.
- 3. Adjust layout settings: Check the preview to ensure your page layout looks correct and that all fixed-width text aligns properly.
- 4. Save as PDF: Click the 'Export to PDF' button to generate and save your perfectly formatted document.

Frequently Asked Questions
Why do my text columns shift when converting plain text to PDF?
This occurs when the PDF converter replaces a fixed-width font (like Courier) with a proportional font (like Arial or Times New Roman). Because characters in proportional fonts have varying widths, text that was originally aligned by space characters will no longer line up vertically.
How can I force my HTML file to use Courier font during conversion?
You can wrap your text blocks in standard <pre> and </pre> tags, or add inline CSS properties like `font-family: 'Courier New', monospace;` to explicitly instruct the converter to maintain a fixed-width font.
Is there a difference between 'Convert HTML' and 'Convert Web Page' in PDF editors?
Yes. These two options frequently utilize entirely different rendering engines. The 'Convert Web Page' option typically captures the exact layout as a modern web browser would render it, making it much more reliable for preserving CSS styling and <pre> tags.




