web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Print all customer account statement into one pdf file

(3) ShareShare
ReportReport
Posted on by
we use D365FO V42 and we need to print customer account statement into one pdf file. 
 
we have around 5000 customers, we run the customer account statement in the batch and we need to generate one pdf file. so we can send this file to third party company to print out and folder into envelope and mail to customer.
 
Please let me know how can we do this?
Categories:
I have the same question (0)
  • Suggested answer
    Saif Ali Sabri Profile Picture
    2,351 Super User 2025 Season 2 on at
    To achieve consolidated printing of customer account statements into a single PDF file in Microsoft Dynamics 365 Finance and Operations (D365FO), version 10.0.42, here's a complete solution approach:

    Business Requirement Summary

    • Print ~5000 customer account statements in a batch job.
    • Output should be one single PDF file.
    • This PDF will be sent to a third-party mailing service for physical mailing.

    🛠️ Standard Limitation

    By default, the Customer account statement (standard SSRS report) prints one customer per report execution and generates multiple files (if saved to disk). The standard D365FO report architecture does not merge multiple SSRS reports into a single PDF.

    Solution Overview

    You can achieve the requirement through one of the following two methods:

    Option 1: Custom SSRS Controller Class with Batch and PDF Merge Logic

    Approach:
    1. Extend the standard controller class for the Customer account statement.
    2. Run the SSRS report for each customer and capture the report output as a stream (byte[]).
    3. Use PDFSharp or iTextSharp (.NET libraries) to merge the individual PDF streams into one PDF.
    4. Save the merged file to a SharePoint, Azure Blob, or File System (if configured).
    Steps:
    1. Create a new batch process that:
      • Retrieves all customers to be included.
      • For each customer:
        • Runs the Customer account statement report via SrsReportRunController.
        • Captures the report output as byte stream.
      • Adds each PDF stream to a merge list.
    2. Merge all PDF streams using PDFSharp/iTextSharp (or similar).
    3. Output the merged PDF to a:
      • File (via File upload parameter),
      • SharePoint document library,
      • Azure Blob (if configured), or
      • Temporary download link.
    4. Optionally, generate a log/report indicating which customers were included.

    🧩 Sample Code Snippet (PDF Merge – Conceptual)

    This would go into a custom class that merges the PDFs.
    csharp
    public class PDFMergeUtility
    {
    public static System.IO.MemoryStream mergePDFs(List<System.IO.MemoryStream> pdfStreams)
    {
    System.IO.MemoryStream output =
    new System.IO.MemoryStream();

    using (PdfSharp.Pdf.PdfDocument outputDocument = new PdfSharp.Pdf.PdfDocument())
    {

    foreach (var stream in pdfStreams)
    {
    PdfSharp.Pdf.PdfDocument inputDocument = PdfSharp.Pdf.IO.PdfReader.Open(stream, PdfSharp.Pdf.IO.PdfDocumentOpenMode.Import);

    for (int i = 0; i < inputDocument.PageCount; i++)
    {
    outputDocument.AddPage(inputDocument.Pages[i]);
    }
    }
    outputDocument.Save(output);
    }

    output.Position =
    0;
    return output;
    }
    }

    You can adapt the above to your D365FO server-side .NET code using permitted libraries or create an external .NET service to handle PDF merging.


    Option 2: Use Electronic Reporting (ER) with Custom Destination

    If you're using Electronic Reporting (ER) for the customer statement:
    1. Configure an ER format for the Customer account statement.
    2. Use a custom destination provider (or extend existing).
    3. In the destination logic, accumulate PDF content in memory and merge it using .NET interop.
    4. At the end of the batch, emit one single PDF file.

    🔐 Deployment & Performance Tips

    • Run in batch mode with sufficient timeout.
    • Run in small chunks (e.g., 1000 customers per run), then merge.
    • Monitor memory and timeout limits in PDF generation and SSRS execution.
    • Consider Azure Functions or Power Automate for offloading PDF merging.

    📦 Output Options

    • Save to SharePoint (if DMS configured).
    • Store in Azure Blob.
    • Allow user to download from document handling.
    • Email the file to an internal mailbox.

    🧾 Final Deliverables

    • One single PDF file with all statements.
    • Optional summary log per customer.
    • Optional watermark or barcode for mailing purposes.

    💡 Optional Enhancements

    • Add QR/barcode per statement page.
    • Add digital signature per statement.
    • Add custom page breaks or separators between customer statements.



     
  • Suggested answer
    Navneeth Nagrajan Profile Picture
    2,407 Super User 2025 Season 2 on at
    Hi SL-22050233-0,
     
    Out of the box with standard D365 F&O having one pdf file for multiple customer account statements is not possible considering that the customer account statements uses the FormLetterFramework where one of the sources could be "Email". Email addresses have a purpose Invoice, Business etc. 
     
    Instead you can have all these pdf files uploaded to a SharePoint file or an Azure blob storage and have them merge through PowerAutomate. Have those pdf files combined into one file and then using the Microsoft 365 Outlook connector have that emailed to the third party company.
     
    This scenario is possible and we have implemented it for one of our customers. Used the below reference link as an example to implement this scenario to send out combined customer statements.
     
    References:
     
    Hope this helps.
  • Suggested answer
    Saif Ali Sabri Profile Picture
    2,351 Super User 2025 Season 2 on at
    @:-  You're absolutely right — and thank you for the clarity. Here's a revised, fully aligned solution answer, assuming only out-of-the-box features in Microsoft Dynamics 365 Finance & Operations (D365FO) without custom X++ development:

    Business Need Recap

    You want to:
    • Generate customer account statements for ~5000 customers.
    • Combine them into a single PDF file.
    • Send the combined PDF to a third-party printing/mailing vendor.

    Standard Limitation

    D365FO does not support merging multiple SSRS report outputs into one PDF natively because:
    • The Customer Account Statement is built on the FormLetterFramework, and
    • It’s designed for per-customer processing, with options like printing or emailing individually, based on the customer's setup (email purpose: Invoice, Business, etc.).

    Out-of-the-Box Feasible Solution Using Power Automate

    🧩 Solution Steps

    1. Run the Customer Account Statement in batch mode in D365FO.
      • Configure it to output each customer’s statement as an individual PDF.
      • Save these PDFs to SharePoint or Azure Blob Storage using Electronic Reporting (ER) Destinations or Document Routing if enabled.
    2. Set up a Power Automate flow that:
      • Triggers on new files added to the folder.
      • Collects all customer statement PDFs.
      • Uses the Adobe PDF Services Connector or Encodian or Plumsail (licensed connectors) to merge PDFs into a single file.
      • Saves the merged PDF to a new folder or overwrites an existing file.
    3. Email the merged PDF to the third-party mailing provider using the Microsoft 365 Outlook connector or SMTP.

    🛠 Tools Required

    • Microsoft Power Automate
    • Adobe PDF Services connector or similar (Encodian, Plumsail, Muhimbi – license may be required)
    • SharePoint Document Library or Azure Blob Storage
    • Configured Electronic Reporting (ER) or Document Management in D365FO

    Advantages

    • No custom code or X++ development needed
    • Fully supported by Microsoft
    • Easily maintainable by business users or IT
    • Scalable to thousands of customer records

    📌 Additional Tips

    • Organize PDFs with a naming convention (e.g., Statement_<CustAccount>_<Date>.pdf)
    • Schedule the Power Automate flow right after the D365FO batch job
    • Use metadata to track processed statements if re-runs are needed

    📄 References


  • Suggested answer
    Anton Venter Profile Picture
    20,345 Super User 2025 Season 2 on at
    There are multiple solutions for this. Using Power Automate / Logic apps / function apps / cloud flows is just one solution but not the only one. Power Automate introduces more points of failure, dependencies, deprecations, possibly expired credentials and more accross different applications in this process. Besides, what is the licensing impact of using a third party tool for just merging files into one file?

    An alternative solution could be: customise the printing of the account statement in F&O to append each PDF file into a single PDF file. This could be done in several ways. I would break it up in several steps. Ideally, the invoice PDF files should be stored somewhere e.g. attached to each invoice in F&O. If that's not the case, create all the PDF files first, save them separately in a database table, then merge them and save the merged file somewhere in a table or whereever.
     
    I would try to use native X++ to merge them or at least leverage some of the .NET framework in F&O. I would only use third party libraries if merging is not doable in X++ or .NET. When all is done, clear the database table so that there is no huge impact on the used F&O database space (i.e. cost).

    I have a few questions. How is the single PDF file sent to the third party for printing? Is a single PDF file a hard requirement from the third party? Why not send the files separately to them?
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans