Fix docx/pptx → PDF conversion broken in v2.2 (clean install + recent Microsoft 365) - #779
Open
mzyqzmd wants to merge 1 commit into
Open
Fix docx/pptx → PDF conversion broken in v2.2 (clean install + recent Microsoft 365)#779mzyqzmd wants to merge 1 commit into
mzyqzmd wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Since v2.2, converting Word/PowerPoint documents to PDF fails.
This PR fixes both root causes so the conversion works again on a
clean install and on current Microsoft 365 builds.
Root cause
v2.2 migrated the Office interop from the Office PIA to NetOffice,
which introduced two independent regressions:
Missing dependencies in the installer (clean-install failure)
Installer/Product.wxswas not updated to ship the NetOfficeassemblies. On a clean machine the conversion crashes with
FileNotFoundException/TypeLoadExceptionbecauseNetOffice.dll, OfficeApi.dll, WordApi.dll, ExcelApi.dll,
PowerPointApi.dll, VBIDEApi.dll are missing from the package.
ExportAsFixedFormatthrows on recent Microsoft 365 (runtime failure)The late-bound ExportAsFixedFormat calls throw
DISP_E_TYPEMISMATCH (0x80020005)on Microsoft 365 builds withtightened type libraries, breaking the conversion even when the
assemblies are present.
Changes
document.SaveAs(path, WdSaveFormat.wdFormatPDF).
conversion does not block on format-compatibility dialogs.
document.SaveAs(path, PpSaveAsFileType.ppSaveAsPDF, msoFalse).
Testing
(page count, CJK fonts, embedded images) via the CLI:
FileConverter.exe --conversion-preset "To Pdf" input.docx
(extract via dark.exe -x).
Scope / known follow-up
Excel → PDF still uses ExportAsFixedFormat because Workbook.SaveAs
does not support PDF output; left unchanged. Same M365 regression
may affect Excel and is a known follow-up.