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:
- Event
OnBeforeApplyPDFMerges
is invoked - After that, the further implementation of the
ApplyPDFMerges
procedure is executed. - 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:
- Event
OnBeforeShouldApplyPDFMerge
is triggered for each PDF merge record. - 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) - If a PDF merge needs to be applied, it is added to a temporary record set which hold the PDF merges to apply
- Event
- For each PDF Merge to apply, the PDF merges are applied:
- Event
OnBeforeApplyPDFMerge
is triggered for each PDF merge record to apply. - The PDF merge is applied.
- Event
- Event
OnApplyPDFMergesOnBeforeFinish
is invoked. - The PDF merging job is finished and the output PDF file is being generated.
- Event
OnAfterApplyPDFMerges
is invoked.