
Goal: Merge an ER-generated PDF with other static PDFs into a single PDF.
I am running an ER format from X++ which generates a Word document output, converted to PDF via ER Destination settings. I want to capture the generated PDF as a MemoryStream to merge it with other PDF documents using DocDocumentHelper::mergePdfDocuments. I am also open to alternative approaches.
What I tried:
ERIFileDestination implementation — implemented Microsoft.Dynamics365.LocalizationFramework.ERIFileDestination and passed it via erRun.withFileDestination(). The saveFile method receives the raw Word template before data binding, not the final populated document.erRun.run(), attempted to read the generated file back from DocuRef linked to ERFormatMappingRunJobTable. However the DocuRef record was not found consistently after the run, making this approach unreliable.Questions:
MemoryStream in X++, without going through Document Management or Archive destination?MemoryStream, what is the best way to display it to the user within D365 (such as opening within a D365 preview pane for immediate viewing)? If that is not possible, opening it in a new browser tab is acceptable as a fallback.