Word PDF Lossless Export
Forces Word to export PDFs with lossless image quality
Author: Joe Ye
Downsampling and JPEG lossy compression are now over, for good.
Microsoft Word has a notorious, long-standing issue when exporting documents to PDF (via File -> Export -> Create PDF/XPS): it aggressively downsamples and re-compresses images. Even if you enable "Do not compress images in file" and select "High fidelity" in Word's options, the internal PDF rendering engine (mso.dll) still runs a hidden optimization pass. It calculates the physical dimensions of the image on the page, (almost always) decides your high-resolution image is "too big", downscales it via GDI+, and forces a secondary JPEG compression. This ruins pixel-perfect diagrams, degrades high-res photos, and introduces irreversible compression artifacts. Which is especially frustrating and super annoying because Word's PDF export is often the go-to solution for sharing documents. We expect it to be every bit as good as the original.
This mod performs a deep, memory-level intervention on Word's internal graphics rendering pipeline to bypass these limitations. It intercepts the core image resolution calculator (DOCEXIMAGE::HrComputeSize) to prevent dimensional downscaling, and hooks the output validator (DOCEXIMAGE::HrCheckForLosslessOutput) to force the engine to use a lossless FLATE (Zlib) stream instead of the default JPEG encoder.
✨ Key Improvements
- Pixel-Perfect Pictures: Solid PNG images, JPEGs and BMPs, etc. are exported with absolute 100% pixel accuracy. No quality loss, no artifacts. PNGs with transparency are guaranteed > 98% pixel accuracy (this is due to limits of GDI+, which does not handle alpha channel perfectly, but it's still a huge improvement over what we currently have. For detailed information, see Test Results below).
- True Lossless Quality: Bypasses Word's forced secondary JPEG compression entirely, preserving the exact quality of your original high-resolution inserts.
- Overrides Broken Settings: Bypasses the hardcoded internal DPI limits that Word's built-in so called "High fidelity" setting fails to disable.
- Cross-Architecture Support: Dynamically adapts to both 64-bit and 32-bit versions of Office using precise memory offsets and calling conventions.
⚙️ Hook Method & Symbol Download Instructions
This mod now features a Hook Method option in the settings, meaning the large PDB symbol file is no longer strictly mandatory. Both methods prioritize a local cache for optimal speed and will automatically fall back to the other if one fails:
- Pattern First (Faster): Prioritizes AOB pattern scanning. It does not require downloading PDBs, though it may be more susceptible to breaking with Office updates.
- PDB First (More Robust): Prioritizes symbol-based hooking. If you select this (or if the mod uses it as a fallback), Windhawk needs the
mso.dll PDB symbol (~90MB) and will download it automatically when you first launch Word.
- If downloading PDB: Please watch the popup in the bottom right corner of your screen (it will show progress like "Loading symbols... 0% (mso.dll)"). Wait patiently until it reaches 100% and disappears. If it fails, please switch your network and try again.
⚠️ IMPORTANT: Whenever you modify the Hook Method option, or after the PDB finishes downloading for the first time, please relaunch Word AS ADMINISTRATOR. This writes the target functions to the local cache, which drastically speeds up Word's launch times later on.
🖼️ Recommended Word Settings for Lossless Images
To ensure Word does not degrade your picture quality, please configure the following built-in settings:
- Navigate to File > Options > Advanced.
- Scroll down to the Image size and quality section.
- *Recommended: In the combobox right next to "Image size and quality", select All New Documents to apply these settings to all future documents created on your PC.
- Tick the box for "Do not compress images in file".
- Select High fidelity as the default resolution.
Note: If your document was saved before this option was applied, its existing images may have already been compressed. You may need to replace and re-insert all pictures, then re-save the document to ensure the images stored within the Word document itself (and not just the exported PDF) are truly lossless.
🧪 Test Results and Verifications
-
Lossless performance guaranteed for JPEGs, BMPs, and other non-transparent formats: 100% lossless pixel-perfect accuracy. No downscaling, no compression artifacts or quality loss.
-
Lossless performance guaranteed for PNGs:
- 100% lossless for PNGs that do not contain transparent regions. (same as above, no downscaling, no compression artifacts or quality loss).
-
98.4% lossless for PNGs that contain transparent regions. (No downscaling, no compression artifacts, and negligible quality loss). This is because of how GDI+ handles transparent images (Pre-multiplied Alpha and Float to Integer rounding error). Combined, these may cause up to ±4 drift out of 255 (±1.6%) on each of 3 RGB channels. Also, RGB values for pixels on complete transparent regions (i.e., alpha strictly equals 0) are discarded by GDI+ for better performance. (which is actually a good thing as it increases redundancy, thus decreasing size of end product).
-
Also, pictures embedded in SVGs are lossless too, because the mod hooks the core image processing pipeline, which applies to all images regardless of their source.
Lossless picture extractor of PDF files are also provided to help you verify the output PDF files. You can get the Python script here.
❌ Before (Input vs Output)

(Image courtesy of Nicky ❤️🌿🐞🌿❤️ from Pixabay)
✅ After (Input vs Output)

🔎 Before vs After at 800% Zoom

(Notice the severe downscaling and compression artifacts in the "Before" image, which are completely gone in the "After" image.)
🖼️ PNG with Transparency Test
(Image courtesy of Sunriseforever from Pixabay)
Before (input vs output):

After (input vs output):

(Notice the pixel value difference of A=0 (fully transparent) pixels, which is caused by GDI+'s handling of transparent images. This is expected.)