I am currently creating a module that allows generating PDFs based on arbitrary entities (or at least nodes). Multiple templates can be defined as config entities. This part already works. I have the config entity set up with create, edit and delete forms and the list.
Now I want to provide a link for each entity of any entity type (i.e. node) like example.com/node/[nid]/pdf/[template_id] that loads the defined template with ID [template_id], generates the PDF and downloads it directly.
What is the correct way? Should I just provide a link through the routing file or is it better to implement a plugin or a custom operation handler or .. I am new to D8 and so I am not aware of all possibilities.