certificate-generator v1.0.0
Revivesoft-Applications
Intro about the repo
The repo serves as the common applications mono repo. The repo uses npm package manager to link packages. Following packages are included in this repo:
- document-processors: This holds processor(s) for documents
- storage-clients: This will include all of the storage clients for revivesoft.
- types: The types would serve as the types available for the project. This is a stand alone package that we can import in server or frontend.
Finally we have one application that uses these packsges under applications.
- document-generator: This app has the lambda function to generate document.
Get Started:
To get started first clone the repo, then run the following two commoands to build the project
npm i
npm run buildThis will build the whole project.
Locally view document-generator app:
To locally run document-generator, navigate to applications/document-generator and run
npm run devThis command above will run the application on local port 3000. On subsequent runs you may need to clear out port 3000 and 30002. Once run you should be able to interact with the api. Set up api with postman and run the documents local api. This is currently set to use storage client s3 to update a doucment.
POST http://localhost:3000/dev/documents[
{
"orientation": "landscape",
"inputFile": {
"storageType": "aws_s3",
"value": "clients/haven/cap/background/default.jpeg",
"width": 297,
"height": 210,
"yAxis": 0,
"xAxis": 0
},
"outputFile": {
"shouldReturn": false,
"storageType": "aws_s3",
"savePath": "clients/haven/cap/files/test.pdf"
},
"items": [
{
"text": {
"yAxis": 70,
"xAxis": 148,
"fontName": "Courier",
"color": {
"ch1": 0,
"ch2": 0,
"ch3": 0
},
"fontSize": 40,
"align": "center",
"value": "Certificate Of Excellence"
},
"type": "text"
},
{
"text": {
"yAxis": 100,
"xAxis": 148,
"fontName": "Courier",
"color": {
"ch1": 0,
"ch2": 0,
"ch3": 0
},
"fontSize": 30,
"align": "center",
"value": "Kam Jiwani"
},
"type": "text"
},
{
"file": {
"yAxis": 10,
"xAxis": 20,
"storageType": "aws_s3",
"width": 40,
"height": 40,
"value": "clients/haven/cap/logos/default_logo.jpeg"
},
"type": "file"
},
{
"file": {
"yAxis": 120,
"xAxis": 190,
"storageType": "aws_s3",
"width": 40,
"height": 40,
"value": "clients/haven/cap/signatures/default_signature.jpeg"
},
"type": "file"
}
]
}]To view the results go to s3 bucket under the outputFile save path to see the results.
For cloud deployed image you can use following endpoint
POST https://o68lir17d0.execute-api.us-east-1.amazonaws.com/dev/documentsThe payload will remain the same. Note in order to make changes and do a fresh cloud deploy you would need to run the following command from applications/document-generator.
npm run deploy12 months ago