From 5ef8e6902e3ce186c1a8d059e894c5762d005da1 Mon Sep 17 00:00:00 2001 From: Chetan Kumar Hirematha Date: Tue, 16 Dec 2025 15:37:23 +0530 Subject: [PATCH 1/6] [MOSIP-44072] : Updated README.md Signed-off-by: Chetan Kumar Hirematha --- README.md | 164 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 143 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 13d3ef3c..c74256b5 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,157 @@ +# Print Service + [![Maven Package upon a push](https://github.com/mosip/print/actions/workflows/push-trigger.yml/badge.svg?branch=release-1.3.x)](https://github.com/mosip/print/actions/workflows/push-trigger.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=release-1.3.x&project=mosip_admin-services&id=mosip_admin-services&metric=alert_status)](https://sonarcloud.io/dashboard?branch=release-1.3.x&id=mosip_admin-services) -# Print Service ## Overview -A reference implementation to print `euin`, `reprint`, `qrcode` [credential types](https://docs.mosip.io/1.2.0/modules/id-repository#credential-types) in PDF format. This service is intended to be customized and used by a card printing agency who need to onboard onto MOSIP as [Credential Partner](https://docs.mosip.io/1.2.0/partners#credential-partner-cp) before deploying the service. + +The **Print Service** is a reference implementation in MOSIP that handles the printing of credentials such as `euin`, `reprint`, and `qrcode` in PDF format. This service is designed to be customized and utilized by card printing agencies onboarding as [Credential Partners](https://docs.mosip.io/1.2.0/partners#credential-partner-cp). + +It operates in an event-driven flow: +1. **Receive Event**: Listens for print request events from WebSub. +2. **Fetch Template**: Retreives the appropriate template from Masterdata. +3. **Generate PDF**: Decrypts resident data and converts it into a PDF card using the template. +4. **Upload**: Uploads the generated PDF to [DataShare](https://docs.mosip.io/1.2.0/modules/data-share). +5. **Notify**: Publishes a status event with the DataShare link back to WebSub. + +The flow is visualized below: ![](docs/print-service.png) -1. Receives events from WebSub. -2. Fetches templates from Masterdata. -3. After creating PDF card print service upload the same to [DataShare](https://docs.mosip.io/1.2.0/modules/data-share). -4. Publishes event to WebSub with updated status and DataShare link. +## Features + +- **Template-Based Printing**: Utilizes Velocity and iText to generate PDFs based on customizable templates. +- **Secure Data Handling**: Decrypts sensitive resident data using partner private keys (`.p12`). +- **DataShare Integration**: Securely uploads generated credential documents. +- **Credential Support**: Native support for EUIN, Reprint, and QR Code credential types. + +## Services + +The Print project consists of the following service: + +1. **[Print Service](.)** (`print`) - The core Spring Boot application responsible for processing print requests and generating the credential PDFs. + +## Database +NA (The service relies on Object Store/DataShare and Masterdata; it does not maintain its own primary database). + +## Local Setup + +The project can be set up in two ways: + +1. [Local Setup (for Development or Contribution)](#local-setup-for-development-or-contribution) +2. [Local Setup with Docker (Easy Setup for Demos)](#local-setup-with-docker-easy-setup-for-demos) + +### Prerequisites + +Before you begin, ensure you have the following installed: + +- **JDK**: 21 +- **Maven**: 3.9.6 (or compatible 3.x version) +- **Docker**: Latest stable version (optional for local run) + +### Runtime Dependencies + +Ensure the following artifacts are available in the classpath or loader path: + +- `kernel-auth-adapter.jar` - For IAM authentication. + +### Configuration + +- Print Service uses configuration files from the **[mosip-config repository](https://github.com/mosip/mosip-config/tree/master)**. +- Refer to the tagged version corresponding to your release. +- **Partner Key**: For local development, place your partner `.p12` file in the `src/main/resources` folder to enable decryption. + +## Installation + +### Local Setup (for Development or Contribution) + +1. Ensure the **Config Server** is running and accessible. + +2. Clone the repository: + +```text +git clone https://github.com/mosip/print.git +cd print +``` -The card data in JSON format is published as WebSub event. The print service consumes the data from event, decrypts using partner private key and converts into PDF using a predefined [template](docs/configuration.md#template). +3. Build the project: -## Build and run (for developers) -Refer [Build and Run](docs/build-and-run.md). - -## Deploy -To deploy print service in production follow the given steps: +```text +mvn clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true +``` -1. Onboard your organisation as [Credential Partner](https://docs.mosip.io/1.2.0/partners). -2. Place your `.p12` file in `../src/main/resources` folder. -3. Set configuration as in given [here](docs/configuation.md). -4. Build and run as given [here](docs/build-and-run.md). +4. Start the application: + - Run via IDE or command line: + ```text + java -jar target/print-*.jar + ``` + - **Note**: Ensure you provide the necessary VM arguments for the Config Server location and loader path for `kernel-auth-adapter.jar` if required. -## Configuration -Refer to the [configuration guide](docs/configuration.md). +### Local Setup with Docker (Easy Setup for Demos) -## Test -Automated functional tests available in [Functional Tests repo](https://github.com/mosip/mosip-functional-tests). +#### Option 1: Pull from Docker Hub + +Recommended for quick demos and testing. + +```text +docker pull mosipid/print-service:1.3.0 +``` + +Run the service: + +```text +docker run -d -p 8099:8099 --name print-service mosipid/print-service:1.3.0 +``` + +#### Option 2: Build Docker Images Locally + +Recommended for developers. + +1. Build the project (as shown in Local Setup). + +2. Build the Docker image: + +```text +docker build -t print-service:local . +``` + +3. Run the service: + +```text +docker run -d -p 8099:8099 --name print-service print-service:local +``` + +#### Verify Installation + +Check that the container is running: + +```text +docker ps +``` + +The service runs on port `8099` by default. + +## Deployment + +### Kubernetes + +To deploy Print Service on a Kubernetes cluster, refer to the [Sandbox Deployment Guide](https://docs.mosip.io/1.2.0/deploymentnew/v3-installation). + +## Documentation + +For additional details, refer to the documents listed below: + +- **[Build and Run Guide](docs/build-and-run.md)**: Detailed instructions for building and running the service. +- **[Configuration Guide](docs/configuration.md)**: Details on configuration properties and template setup. + +## Contribution & Community + +• To learn how you can contribute code to this application, [click here](https://docs.mosip.io/1.2.0/community/code-contributions). + +• If you have questions or encounter issues, visit the [MOSIP Community](https://community.mosip.io/) for support. + +• For any GitHub issues: [Report here](https://github.com/mosip/print/issues) ## License -This project is licensed under the terms of [Mozilla Public License 2.0](LICENSE). + +This project is licensed under the [Mozilla Public License 2.0](LICENSE). From 526045ee42871f7225bb8e6997953ec9d2d68056 Mon Sep 17 00:00:00 2001 From: Chetan Kumar Hirematha Date: Tue, 16 Dec 2025 17:44:36 +0530 Subject: [PATCH 2/6] [MOSIP-44072] : Updated README.md Signed-off-by: Chetan Kumar Hirematha --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c74256b5..15f9b27f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Print Service [![Maven Package upon a push](https://github.com/mosip/print/actions/workflows/push-trigger.yml/badge.svg?branch=release-1.3.x)](https://github.com/mosip/print/actions/workflows/push-trigger.yml) -[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=release-1.3.x&project=mosip_admin-services&id=mosip_admin-services&metric=alert_status)](https://sonarcloud.io/dashboard?branch=release-1.3.x&id=mosip_admin-services) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?branch=release-1.3.x&project=mosip_print&id=mosip_print&metric=alert_status)](https://sonarcloud.io/dashboard?branch=release-1.3.x&id=mosip_print) ## Overview @@ -65,7 +65,7 @@ Ensure the following artifacts are available in the classpath or loader path: ### Local Setup (for Development or Contribution) -1. Ensure the **Config Server** is running and accessible. +1. Ensure the **Config Server** is running and accessible.To run config server [check here.](https://github.com/mosip/mosip-config/blob/master/README.md) 2. Clone the repository: @@ -83,9 +83,9 @@ mvn clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true 4. Start the application: - Run via IDE or command line: ```text - java -jar target/print-*.jar + java -Dloader.path= \ + -jar target/print-*.jar ``` - - **Note**: Ensure you provide the necessary VM arguments for the Config Server location and loader path for `kernel-auth-adapter.jar` if required. ### Local Setup with Docker (Easy Setup for Demos) From 53f2104481db9b0cd06c1bb0ef3a1ffc2b6bcc93 Mon Sep 17 00:00:00 2001 From: Chetan Kumar Hirematha Date: Tue, 16 Dec 2025 18:33:44 +0530 Subject: [PATCH 3/6] [MOSIP-44072] : Updated README.md Signed-off-by: Chetan Kumar Hirematha --- README.md | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 15f9b27f..d763179b 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ## Overview -The **Print Service** is a reference implementation in MOSIP that handles the printing of credentials such as `euin`, `reprint`, and `qrcode` in PDF format. This service is designed to be customized and utilized by card printing agencies onboarding as [Credential Partners](https://docs.mosip.io/1.2.0/partners#credential-partner-cp). +The **Print Service** is a reference implementation in MOSIP that handles the printing of credentials such as `euin`, `reprint`, and `qrcode` in PDF format. This service is designed to be customized and utilized by card printing agencies onboarding as [Credential Partners](https://docs.mosip.io/1.2.0/partners#credential-partner-cp).This reference implementation can be referred by any credential sharing request. It operates in an event-driven flow: 1. **Receive Event**: Listens for print request events from WebSub. @@ -34,6 +34,20 @@ The Print project consists of the following service: ## Database NA (The service relies on Object Store/DataShare and Masterdata; it does not maintain its own primary database). +## Build and run (for developers) +Refer [Build and Run](docs/build-and-run.md). + +## Deploy +To deploy print service in production follow the given steps: + +1. Onboard your organisation as [Credential Partner](https://docs.mosip.io/1.2.0/partners). +2. Place your `.p12` file in `../src/main/resources` folder. +3. Set configuration as in given [here](https://github.com/mosip/mosip-config/blob/release-1.3.x/print-default.properties). +4. Build and run as given [here](docs/build-and-run.md). + +## Test +Automated functional tests available in [Functional Tests repo](https://github.com/mosip/mosip-functional-tests). + ## Local Setup The project can be set up in two ways: @@ -55,14 +69,11 @@ Ensure the following artifacts are available in the classpath or loader path: - `kernel-auth-adapter.jar` - For IAM authentication. -### Configuration - -- Print Service uses configuration files from the **[mosip-config repository](https://github.com/mosip/mosip-config/tree/master)**. -- Refer to the tagged version corresponding to your release. -- **Partner Key**: For local development, place your partner `.p12` file in the `src/main/resources` folder to enable decryption. - ## Installation +### Configuration +Print uses properties from **mosip-config**. +You can check the configuration here: [print-default.properties](https://github.com/mosip/mosip-config/blob/release-1.3.x/print-default.properties) ### Local Setup (for Development or Contribution) 1. Ensure the **Config Server** is running and accessible.To run config server [check here.](https://github.com/mosip/mosip-config/blob/master/README.md) @@ -131,11 +142,7 @@ docker ps The service runs on port `8099` by default. -## Deployment - -### Kubernetes -To deploy Print Service on a Kubernetes cluster, refer to the [Sandbox Deployment Guide](https://docs.mosip.io/1.2.0/deploymentnew/v3-installation). ## Documentation From 818b55c1cc2470f082cb18a09ce7f0d0f3c7eb98 Mon Sep 17 00:00:00 2001 From: Chetan Kumar Hirematha Date: Tue, 16 Dec 2025 18:41:47 +0530 Subject: [PATCH 4/6] [MOSIP-44072] : Updated README.md Signed-off-by: Chetan Kumar Hirematha --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d763179b..2ef7b4ce 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ## Overview -The **Print Service** is a reference implementation in MOSIP that handles the printing of credentials such as `euin`, `reprint`, and `qrcode` in PDF format. This service is designed to be customized and utilized by card printing agencies onboarding as [Credential Partners](https://docs.mosip.io/1.2.0/partners#credential-partner-cp).This reference implementation can be referred by any credential sharing request. +The **Print Service** is a reference implementation in MOSIP that handles the printing of credentials such as `euin`, `reprint`, and `qrcode` [credential types](https://docs.mosip.io/1.2.0/modules/id-repository#credential-types) in PDF format. This service is designed to be customized and utilized by card printing agencies onboarding as [Credential Partners](https://docs.mosip.io/1.2.0/partners#credential-partner-cp).This reference implementation can be referred by any credential sharing request. It operates in an event-driven flow: 1. **Receive Event**: Listens for print request events from WebSub. From ad372e6eaf16f627e4bbaa9f9665fc7f8f7ec8df Mon Sep 17 00:00:00 2001 From: Chetan Kumar Hirematha Date: Tue, 16 Dec 2025 19:12:32 +0530 Subject: [PATCH 5/6] Fix typo in README.md for 'Retrieves' Signed-off-by: Chetan Kumar Hirematha --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2ef7b4ce..44d6ba80 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The **Print Service** is a reference implementation in MOSIP that handles the pr It operates in an event-driven flow: 1. **Receive Event**: Listens for print request events from WebSub. -2. **Fetch Template**: Retreives the appropriate template from Masterdata. +2. **Fetch Template**: Retrieves the appropriate template from Masterdata. 3. **Generate PDF**: Decrypts resident data and converts it into a PDF card using the template. 4. **Upload**: Uploads the generated PDF to [DataShare](https://docs.mosip.io/1.2.0/modules/data-share). 5. **Notify**: Publishes a status event with the DataShare link back to WebSub. From 1a78f8a1b335d3e42527fae70731d6d17b7f28a9 Mon Sep 17 00:00:00 2001 From: Chetan Kumar Hirematha Date: Tue, 16 Dec 2025 19:31:57 +0530 Subject: [PATCH 6/6] Update DataShare link in README Signed-off-by: Chetan Kumar Hirematha --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 44d6ba80..7dc45bd5 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It operates in an event-driven flow: 1. **Receive Event**: Listens for print request events from WebSub. 2. **Fetch Template**: Retrieves the appropriate template from Masterdata. 3. **Generate PDF**: Decrypts resident data and converts it into a PDF card using the template. -4. **Upload**: Uploads the generated PDF to [DataShare](https://docs.mosip.io/1.2.0/modules/data-share). +4. **Upload**: Uploads the generated PDF to [DataShare](https://docs.mosip.io/1.2.0/id-lifecycle-management/supporting-components/datashare). 5. **Notify**: Publishes a status event with the DataShare link back to WebSub. The flow is visualized below: