Markdown Exported to PDF Is a Blank Page: How to Fix It
Blank pages or missing body text after exporting Markdown to PDF are usually caused by an empty source file, incorrect encoding or fonts, or rendering that has not finished. This article explains how to identify the symptoms, troubleshoot each cause step by step, and prevent the problem.
Key Points of This Article
- First, confirm the source file actually contains visible body text; open it in a plain-text editor to check, since most blank-page problems can be spotted at this step.
- If Chinese characters appear as boxes or disappear, the encoding is usually not UTF-8, or the font lacks Chinese glyphs; re-save the file as UTF-8 and specify a Chinese font.
- If formulas, flowcharts, or syntax-highlighted code areas are blank, the rendering script has most likely not finished running; wait for rendering to complete before exporting.
- Use a minimal sample containing a title, Chinese text, a formula, and an image as a control to quickly tell whether the problem lies in the document or in the environment.
If you finish writing a document in Markdown, export it to PDF, and open it to find only a blank page, or just page numbers and a header with no body text, the problem usually lies not in the export tool itself but in some step involving content, encoding, fonts, or rendering state. This article is written for people who are writing technical notes, thesis drafts, reading summaries, or project documentation and need to turn Markdown into a PDF for delivery.
After reading this, you should be able to do three things: first, spend a few minutes working out which category the blank space belongs to; then check each item in order from easiest to hardest; and finally lock in the fix so you don't run into the same problem again. The methods below apply to most workflows that render Markdown to HTML before outputting a PDF, and also to online conversion tools and desktop software.
Markdown export to PDF is blank — what should I do? One-sentence conclusion
First confirm that the source file actually contains visible text, then check the encoding and fonts, and finally verify whether rendering has completed. Most blank-output problems can be resolved in the first two steps, so there is no need to rush into switching tools.
| Your situation | Recommended Practices | Cause |
|---|---|---|
| The source file opens empty, or only shows the metadata block at the top. | First complete the main text, save, then re-export. | The exporter can only output what it reads, so if the source is empty, the result will inevitably be blank. |
| Chinese text displays as boxes, or doesn't appear at all | Save as UTF-8, specifying a font that includes Chinese glyphs | When encoding errors occur or fonts are missing, the text either appears garbled or is not rendered at all. |
| Blank areas in formulas, flowcharts, or code highlighting | Wait for rendering to finish before exporting, and confirm that the charts are displayed in the preview before exporting. | The script didn't finish running before the PDF was generated, so these areas will be left blank. |
| After uploading to the online conversion website, I get a blank file. | Check the original file locally, and test again with a minimal sample. | The upload process may lose content, or the website may handle special syntax differently. |
First, determine which type of problem it is
Look at the symptoms first, then match them to the right category, and you can avoid many detours.
| Symptoms | Common causes | How to confirm? |
|---|---|---|
| The PDF is entirely blank, but the page count is normal. | The source file is empty, the body text is commented out, and the styles hide the body text. | Open the source file in a plain-text editor to check whether the body text is present; open the intermediate generated HTML in a browser to check whether the content is visible. |
| Only Chinese text isn't displaying, English is fine | The file is not encoded in UTF-8, or the font is missing Chinese glyphs | Open it in an editor to check or switch the encoding, then re-export it; in the PDF, try selecting the text to see whether there is selectable text. |
| Only formulas, charts, or code blocks are blank | Rendering script not finished, or the related plugin is not loaded | Before exporting, check in the preview whether these areas are displayed as graphics or highlighted code. |
| There is a large blank area at the top of the page, and the body text is crowded onto the next page. | Abnormal page margin, page break, or print style settings | Turn to pages 2 and 3, and determine whether the content has been pushed back. |
| A certain reader is blank; switch to a normal one. | Readers differ in their support for fonts and special objects. | Open the same file with another PDF reader or a web browser |
Item-by-item troubleshooting and fixing
- Check whether the source file has content. Open the .md file in a plain-text editor and confirm that the body text is not wrapped in the comment markers
<!-- -->, and that no whole section has been accidentally placed inside a code fence. If the file contains only the front-matter block and the body is empty, add the body text before exporting. - Check the encoding. In the editor, save the file as UTF-8. Some desktop office programs or older tools may save files in GBK encoding, and after export the Chinese text will show up as boxes or disappear entirely. When saving, pay attention to whether a BOM is included, and follow the export tool's instructions.
- Confirm a Chinese font. If the export environment allows you to specify a font, choose one that includes Chinese glyphs, such as the system's SimHei or SimSun, or an open-source Chinese font. If your style file sets a font list, make sure it contains a Chinese font name and that this font is installed on the computer.
- Check for hidden styles. If the export pipeline goes through HTML and CSS, search the styles for
display: none,visibility: hidden, or any setting where the text color matches the background color. Also check whether@media printhides the container that holds the body text; a container whose width is set to 0 will also make the content disappear. - Wait for rendering to finish. Documents containing formulas, flowcharts, and code highlighting need scripts to convert them into graphics first. If the export tool offers a wait or delay option, increase the waiting time appropriately. When printing manually from a browser, first confirm that the charts on the page have been displayed before printing. You can also open the content in the UniDoc web editor (app.unidoc.top) first, check that formulas and charts display correctly, and then decide how to export.
- Handle image paths. A broken image link or a relative path that does not exist usually just leaves a blank space where the image should be, while the text still displays. Place the images in the same directory as the document or in its subdirectories, use relative paths consistently, and compare the results before and after export.
- Locate the problem by binary search. Split the document in the middle and export each half separately. Whichever half is blank, remove sections from that half one by one; this usually pinpoints the problem within a few rounds. An unclosed code fence is a common culprit, since it causes everything after it to be treated as code.
- Confirm with a different reader. If the PDF file itself is fine and only one reader shows it as blank, open it in another reader or browser. If it is still blank, go back and work through the earlier steps.
How to Avoid This Happening Again
- Fix the writing environment. Save the document as UTF-8 from the moment it is created, and preset the Chinese font in the template to avoid adjusting it each time.
- Preview before exporting. Body text, formulas, charts, and code blocks should all display correctly in the preview before you export.
- Keep a minimal sample. The sample should contain only one heading, one paragraph of Chinese text, one formula, and one image. Each time you change tools or modify styles, use it first to verify the export pipeline.
- Reduce complex structures. Try to avoid mixing large blocks of HTML into Markdown, and avoid syntax that requires extra scripts to display, which lowers the chance of rendering failures.
- Use relative paths for images. Place assets in a directory next to the document so that images are not lost when the folder is moved.
- Search for a keyword after exporting. Search the PDF for a Chinese word from the document. If it is found, the text layer is working correctly; if not, the text was not written properly.
- Record the export environment. Note the tool version, fonts used, and system information so you can compare when problems arise next time.
❓ Frequently Asked Questions (FAQ)
1. Why does the exported PDF show only page numbers and headers, with a blank body?
It's most likely that the body text is being commented out or covered by a hidden style, or that an unclosed piece of syntax is swallowing everything after it. First check the source file in a plain text editor, then work through steps 1, 4, and 7 above.
2. Why do Chinese characters display as boxes while English displays normally?
This is usually because the font lacks Chinese glyphs, or the file encoding is not UTF-8. Switch to a font that includes Chinese characters, confirm the encoding is UTF-8, and then re-export; this usually resolves the issue.
3. How can I avoid blank pages and watermark issues when exporting with free tools?
When choosing one, check a few things: whether it limits file size and page count, whether exported results carry a watermark, whether it preserves the text layer and original layout, and whether its statement on file privacy is clear. Testing with a short sample containing Chinese text, formulas, and images is more reliable than relying only on the promotional pages.
4. The exported PDF displays normally, but the copied text is all garbled. What should I do?
This indicates a problem with font embedding or character mapping. Switch to an export setting that includes the complete font, or replace the font with a common Chinese font before exporting, then copy a short passage of text to test.
5. Is it a problem with the export tool, or did I write the Markdown wrong?
Comparing with a minimal sample is enough to tell the cause. If the same sample exports correctly but the formal document comes out blank, the problem most likely lies in the document's content. If the sample is also blank, the problem most likely lies in the environment or tool settings.
📝 Summary
Markdown-to-PDF export comes out blank for a few common reasons: the source file is empty, the encoding or font is wrong, or rendering didn't finish. Start by identifying the symptom, then check the causes from easiest to hardest, and use a minimal sample file as a control. This usually finds the cause, and it helps prevent the problem from recurring.


