Skip to content

API Reference Introduction

In this reference documentation you can find an overview of all the objects that make up the public Application Programming Interface (API) of the latest version of the PDF Merge extension for Microsoft Dynamics 365 Business Central.

This documentation is intended as a reference for Business Central extension developers who would like to use the exposed functionality in their own extensions.

Merge Flow

The diagram below describes the main flow of what happens when the Apportunix PDF Merge extension applies the merges configured on the PDF Merge Setup page.

flowchart TD OnBeforeApplyPDFMerges(OnBeforeApplyPDFMerges) --> NextMergeToCheckCondition; NextMergeToCheckCondition{{Any Merge to Check Left?}} -- Yes --> OnBeforeShouldApplyPDFMerge OnBeforeShouldApplyPDFMerge(OnBeforeShouldApplyPDFMerge) --> ShouldApplyMergeCondition ShouldApplyMergeCondition{{Should apply PDF Merge?}} -- Yes --> AddPDFMergeToApply AddPDFMergeToApply --> NextMergeToCheckCondition ShouldApplyMergeCondition{{Should apply PDF Merge?}} -- No --> NextMergeToCheckCondition NextMergeToCheckCondition -- No --> NextMergeToApplyCondition NextMergeToApplyCondition{{Any Merge to Apply Left?}} -- Yes --> OnBeforeApplyPDFMerge(OnBeforeApplyPDFMerge) OnBeforeApplyPDFMerge --> ApplyPDFMerge([ApplyPDFMerge]) ApplyPDFMerge --> NextMergeToApplyCondition NextMergeToApplyCondition -- No --> OnApplyPDFMergesOnBeforeFinish OnApplyPDFMergesOnBeforeFinish(OnApplyPDFMergesOnBeforeFinish) --> Finish Finish([Finish]) --> OnAfterApplyPDFMerges OnAfterApplyPDFMerges(OnAfterApplyPDFMerges) style OnBeforeApplyPDFMerges color:blue style OnBeforeShouldApplyPDFMerge color:blue style OnBeforeApplyPDFMerge color:blue style OnApplyPDFMergesOnBeforeFinish color:blue style OnAfterApplyPDFMerges color:blue style NextMergeToCheckCondition color:#AB7009 style ShouldApplyMergeCondition color:#AB7009 style NextMergeToApplyCondition color:#AB7009

When a PDF merge job is executed via Apportunix PDF Merge, the following happens:

  1. Event OnBeforeApplyPDFMerges is invoked
  2. After that, the further implementation of the ApplyPDFMerges procedure is executed.
  3. For each PDF merge (e.g., applying underlays/stationery or append actions) configured in the PDF Merge Setup a check is performed of whether they should be applied or not:
    1. Event OnBeforeShouldApplyPDFMerge is triggered for each PDF merge record.
    2. After that, the further implementation of the GetMergesToApply procedure checks if the PDF merge record meets the conditions to be applied (e.g., based on report ID or current company)
    3. If a PDF merge needs to be applied, it is added to a temporary record set which hold the PDF merges to apply
  4. For each PDF Merge to apply, the PDF merges are applied:
    1. Event OnBeforeApplyPDFMerge is triggered for each PDF merge record to apply.
    2. The PDF merge is applied.
  5. Event OnApplyPDFMergesOnBeforeFinish is invoked.
  6. The PDF merging job is finished and the output PDF file is being generated.
  7. Event OnAfterApplyPDFMerges is invoked.