community postAL Developmentcommunity - not Microsoftreviewed - checked by Opus

Dynamics 365 Business Central: Convert Word (.docx) To PDF (.pdf) within BC (No control add-in and APIs)

Converting Word documents to PDF format within Business Central can be achieved using the built-in ConvertWordToPdf procedure from codeunit 9651 without requiring control add-ins or external APIs. The post demonstrates two practical approaches: converting attached Word documents and uploading documents for conversion, with complete source code examples.

post Dynamics 365 Lab

Yun Zhu · 2025-05-08 · 491 words · about 2 min

"codeunit 9651 "Document Report Mgt." -> procedure ConvertWordToPdf(var TempBlob: Codeunit "Temp Blob"; ReportID: Integer)"

Key points

  • Use codeunit 9651 Document Report Mgt. and its ConvertWordToPdf procedure to convert DOCX files to PDF
  • No control add-ins or external APIs required for the conversion functionality
  • Can integrate conversion into page extensions to add Word-to-PDF conversion actions
  • The method handles document attachments through temp blob objects for streaming

Quotes

  • “codeunit 9651 “Document Report Mgt.” -> procedure ConvertWordToPdf(var TempBlob: Codeunit “Temp Blob”; ReportID: Integer)” (Identifies the exact system procedure developers should use for Word-to-PDF conversion without external tools)

AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

No source states these links: they share an object, a model read them, or a person found the same subject.

Heads up

  • warning: “The document contains elements that cannot be converted to PDF. This may be caused by missing image data in the document.”

Context

  • Features: Convert Word to PDF, Document attachments, Word layouts, File conversion, Stream handling

Source: Dynamics 365 Lab - Yun Zhu, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.