# Common Master-Detail Image in HTML Document Common Master-Detail Image in HTML Document with GroupDocs.Assembly for Python via .NET: customers' photos embedded as Base64 data, their names and products, from Python data. {{< alert style="info" >}}In this article, we will use GroupDocs.Assembly to generate a Common Master-Detail report in HTML Document format.{{< /alert >}}{{< alert style="info" >}}The examples read the shop data described in [The Business Layer]({{< ref "assembly/python-net/developer-guide/basic-usage/working-with-a-business-case/the-business-layer.md" >}}).{{< /alert >}} ## Common Master-Detail Image in HTML Document ### Reporting Requirement As a report developer, you are required to represent the information of the customers and products with the following key requirements: * Report must show customers' picture and name. * It must associate the customers with their products. * Report must be generated in the HTML Document. ### Adding Syntax to be evaluated by GroupDocs.Assembly Engine An HTML report cannot hold a picture file, so the template embeds each customer's photo in an `img` element as Base64-encoded data. The template is an HTML file whose tags are written with the angle brackets escaped, `<<` and `>>`, so that the HTML stays valid: ```text
<<foreach [in customers]>>Products: <<foreach [in Order]>><<[IndexOf() != 0 ? ", " : ""]>><<[Product.ProductName]>><</foreach>>
<</foreach>> ``` The .NET template computes the Base64 text in the template, with a C# helper class registered as a known type (`FileUtil.GetBytesAsBase64(Photo)`). In Python, the code computes it while loading the data and gives each customer a `PhotoBase64` member, so the template only outputs it. {{< alert style="success" >}}For detailed technical information about syntax, expressions and report generation by the engine, please visit: [Working with GroupDocs.Assembly Engine]({{< ref "assembly/python-net/developer-guide/basic-usage/working-with-groupdocs.assembly-engine/_index.md" >}}).{{< /alert >}} ### Download Common Master-Detail Template Please download the sample Common master-detail document we created in this article: * [common-master-detail-photos.html](https://docs.groupdocs.com/assembly/python-net/_sample_files/developer-guide/advanced-usage/working-with-image-reports-common-master-detail/common-master-detail-image-in-html-document/common-master-detail-photos.html) ### Generating The Report Each customer's `Photo` is the file name of its picture. The code reads each picture and stores its Base64 text in the customer's dict. {{< tabs "example1" >}} {{< tab "Python" >}} ```python import base64 import json from groupdocs.assembly import DataSourceInfo, DocumentAssembler with open("customers.json", encoding="utf-8") as f: customers = json.load(f) # An HTML report embeds each photo as Base64 text for customer in customers: with open(customer["Photo"], "rb") as photo: customer["PhotoBase64"] = base64.b64encode(photo.read()).decode("ascii") assembler = DocumentAssembler() assembler.assemble_document("common-master-detail-photos.html", "common-master-detail-photos-report.html", DataSourceInfo(customers, "customers")) ``` {{< /tab >}} {{< tab "common-master-detail-photos.html" >}} {{< tab-text >}} The following sample file is used in this example: [common-master-detail-photos.html](https://docs.groupdocs.com/assembly/python-net/_sample_files/developer-guide/advanced-usage/working-with-image-reports-common-master-detail/common-master-detail-image-in-html-document/common-master-detail-photos.html) {{< /tab-text >}} {{< /tab >}} {{< tab "customers.json" >}} {{< tab-text >}} The following sample file is used in this example: [customers.json](https://docs.groupdocs.com/assembly/python-net/_sample_files/developer-guide/advanced-usage/working-with-image-reports-common-master-detail/common-master-detail-image-in-html-document/customers.json) {{< /tab-text >}} {{< /tab >}} {{< tab "quayside-bistro.png" >}} {{< tab-text >}} The following sample file is used in this example: [quayside-bistro.png](https://docs.groupdocs.com/assembly/python-net/_sample_files/developer-guide/advanced-usage/working-with-image-reports-common-master-detail/common-master-detail-image-in-html-document/quayside-bistro.png) {{< /tab-text >}} {{< /tab >}} {{< tab "lantern-street-cafe.png" >}} {{< tab-text >}} The following sample file is used in this example: [lantern-street-cafe.png](https://docs.groupdocs.com/assembly/python-net/_sample_files/developer-guide/advanced-usage/working-with-image-reports-common-master-detail/common-master-detail-image-in-html-document/lantern-street-cafe.png) {{< /tab-text >}} {{< /tab >}} {{< tab "saltmarsh-deli.png" >}} {{< tab-text >}} The following sample file is used in this example: [saltmarsh-deli.png](https://docs.groupdocs.com/assembly/python-net/_sample_files/developer-guide/advanced-usage/working-with-image-reports-common-master-detail/common-master-detail-image-in-html-document/saltmarsh-deli.png) {{< /tab-text >}} {{< /tab >}} {{< tab "pier-nine-kitchen.png" >}} {{< tab-text >}} The following sample file is used in this example: [pier-nine-kitchen.png](https://docs.groupdocs.com/assembly/python-net/_sample_files/developer-guide/advanced-usage/working-with-image-reports-common-master-detail/common-master-detail-image-in-html-document/pier-nine-kitchen.png) {{< /tab-text >}} {{< /tab >}} {{< tab "common-master-detail-photos-report.html" >}} ```text