How to Fix Truncated Text When Converting HTML to PDF
Question details
The user needs to prevent text from being cut off or missing when converting an HTML webpage into a PDF document.

- Product
- PDF Converter
- Device & OS
- not provided
- Scenario
- Converting an HTML webpage to a PDF document for offline reading, archiving, or distribution.
- Observed behavior
- The resulting PDF file has missing or truncated text, likely due to improper HTML/CSS layout rendering or PDF engine limitations.
Before troubleshooting, ensure you have access to the source code of the HTML page if you are the website owner, or try adjusting your browser's print scaling settings if you are just a visitor.
Inspect and Adjust HTML and CSS Settings
Modifying the webpage's source code, specifically CSS rules related to height and overflow, is the most effective way to prevent text truncation during PDF generation.
Web browsers and PDF engines often struggle to render responsive web designs into fixed-page PDF formats. Elements with fixed heights or hidden overflows are the most common culprits for truncated text.
Locate any 'height' properties in your CSS for containers holding text and change them to 'auto' or 'min-height' so they can expand dynamically during the PDF generation.
Check for 'overflow: hidden;' in your CSS. Change this to 'overflow: visible;' specifically for print media queries to ensure all text is rendered.
Add the CSS rule 'page-break-inside: avoid;' or 'break-inside: avoid;' to essential elements like paragraphs, tables, and divs to prevent them from being cut in half across PDF pages.

Use a Dedicated PDF Production Tool
Standard browser 'Print to PDF' engines often struggle with complex layouts. Using a dedicated PDF production tool provides better layout control.
Convert HTML and Documents to PDF with WPS Office
WPS Office provides a robust PDF conversion engine that helps you create, edit, and export PDF files with precise layout retention, minimizing errors like truncated text.
- 1. Open WPS Office: Launch the WPS Office application on your computer or mobile device.
- 2. Access the PDF Tools: Click on the 'PDF' tab in the main interface and select the 'Create PDF' or 'PDF Conversion' tool.
- 3. Convert to PDF: Import your source document or webpage, adjust the page layout settings, and click 'Export to PDF' for a flawless conversion without truncated text.

Frequently Asked Questions
Why does my text get cut off at the bottom of the PDF page?
This usually happens because the HTML element does not have proper page-break rules. Adding 'page-break-inside: avoid;' or 'break-inside: avoid;' to your CSS forces the PDF engine to push the entire element to the next page instead of cutting it in half.
Can I fix truncated PDF text without changing the website's code?
If you are a visitor without access to the code, you can try adjusting the 'Scale' setting in your browser's Print to PDF dialog to a smaller percentage (e.g., 80%) or changing the page orientation to Landscape to fit more text on the screen before saving.
Does the font choice affect HTML to PDF conversion?
Yes. If the PDF conversion engine does not support or cannot load a specific web font, it may substitute it with a default font that has different character spacing or sizing. This can unexpectedly push text outside of its container, causing truncation.
What is the best alternative to browser 'Print to PDF'?
Using dedicated PDF production software, such as WPS Office or specialized HTML-to-PDF APIs, often yields better results because they utilize advanced rendering engines specifically designed to respect print layouts, typography, and document margins.




