Altinn / app-lib-dotnet

Libraries used in Altinn Apps
BSD 3-Clause "New" or "Revised" License
7 stars 10 forks source link

Need ability to specify name for generated PDFs #679

Open HauklandJ opened 3 weeks ago

HauklandJ commented 3 weeks ago

Part of the Underskjema Epic

To support the generation of one PDF per sub form, we need a mechanism for naming PDFs to avoid name collision and to have a semantic domain-related name to easily be distinguished from others.

We should expose the naming rules to the Service Owner app developers. Could be done with expressions.

With PDF as its own taskExtension taskType, we could include a pdfConfig section which could include PdfName, something like this:

<bpmn:task id="Task_1" name="Utfylling">
      <bpmn:extensionElements>
        <altinn:taskExtension>
          <altinn:taskType>data</altinn:taskType>
        </altinn:taskExtension>
      </bpmn:extensionElements>
</bpmn:task>

<bpmn:task id="Task_2" name="Altinn pdf task">
    <bpmn:extensionElements>
        <altinn:taskExtension>
            <altinn:taskType>pdf</altinn:taskType>
            <altinn:pdfConfig>
                <altinn:pdfName>PdfNameExpressionHere</altinn:pdfName> //Hardkodet string, text resource, expression
                <altinn:tasksToIncludeInPdf>
                    <altinn:taskId>Task_1</altinn:taskId>
                </altinn:tasksToIncludeInPdf>
            </altinn:pdfConfig>
        </altinn:taskExtension>
    </bpmn:extensionElements>
</bpmn:task>

TasksToInclude: hvis det er server task så vil det ikke være noe layout set, så frontend vil ikke rendre noe.

bjosttveit commented 3 weeks ago

The file name is determined by app-lib-dotnet, based on the appName in text resources currently it seems. So maybe this issue belongs there? Unless there is a way for app-frontend to expose this in the PDF file? Though, I suspect there is not, as we currently cannot even set the document title https://github.com/Altinn/app-lib-dotnet/issues/196