OL Learn

Email PDF optimization - Workflow/Template

Situation:
we have one template with several sections for different documents/medias. which documents we have to create, differs for every record. some customers (one record = one customer) get their documents printed. for those we duplicate the records in the datamapper and determine the correct sections to enable in a control script in the template. for customers who get their documents by email, we don’t duplicate in the datamapper but create one mail per customer an activate the correct print sections. the “magic attachment check box” “Print context as PDF document” takes care of the rest.

Problem:
pdfs created by the “magic checkbox” are larger than pdf created as actual print output. that is unfortunate because i like the magic part very much.

Solution?
While the process described above seemed to me as if it is “the way” the software intended to do pdf-attachments, the best practice way seems to be to create all pdfs as print-output and afterwards attach the correct pdfs to the correct mail. but i cant wrap my head around how to do it.

My best guess would be to introduce a parameter to tell the mapper (and the template) which step we are currently in:

  • first datamapper: duplicate records like for printing

  • Create PDFs via print output

  • second datamapper: the same file but without duplication

  • Create one mail for each customer, find the correct pdfs and attach them

Am I on the right track - any hints? to me it seems like it is not the intended way…