1

Status quo

In our solution we are doing some post-processing to the PDF-documents generated by Business Central.

That includes adding stationery papers, inserting blank pages (to allow printing duplex with more than one document in a pdf), appending other documents etc. and also moving the documents to an archive after the post-processing.

To accomplish this task, we subscribed to the OnAfterDocumentReady-event.

I am aware of the OnPreRendering-Event, but that does not fit our requirements (especially PDFA and embedding Zugferd is bugged)


Problem

In some customer environments, other partner's solutions also subscribe to this event, which causes trouble.

The arguments include a stream for the original source document (read-only) and the result document (write-only).


Depending on the (random) execution-sequence of all subscribers, we encounter situations, where we may not continue applying our modifications, because

  • the documentStream was already read (which may be mitigated by resetting the position, but this ignores other subscribers' output)
  • the TargetStream may already contain data - appending another post-processed copy is not an option because it will lead to invalid file contents


Goals

  1. I'd like to have a possibility to retrieve and write the document into a TempBlob-Codeunit instead of a stream so that multiple subscribers can add their content
  2. it'd be great to distinguish between the "wip"-document and the final output, so either separate events are needed or any possibility to influence the order of the subscribers with a priority or a "render-stage"-Enum


Category: Development
STATUS DETAILS
New