<h1 align="center"> PDF Generator</h1> <br>

<p align="center">
  This is the NodeJS service to generate PDF documents from HTML
</p>


## Table of Contents

- [Introduction](#introduction)
- [Features](#features)
- [Requirements](#requirements)
- [Quick Start](#quick-start)
- [Testing](#testing)
- [Dependencies](#Depemndency)
- [Install Commands](#Install)



## Introduction
This Microservice was created by Silicon Overdrive to solve a problem with Lambda that struggled with generating PDF in there enviroment.
You can post to the server IP address on port 8080 with the JSON Payload. The service will return JSON, with filename and Path 

## Requirements
AWS AEC2 , S3 permissions , Lamda Access via same Security Groups if seperate

## Quick Start
Creat AWS Account, Start a AWS Linux 2 IAM. Do software installs. Clone Repo ,  Run index file

## Testing
Everything is logged in CloudWatch, and on instance there is a cli command : pm2 log

## Depemndency
NodeJS , NPM , PM2 , PhantomJS , GIT , aws-sdk

## Install
sudo yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
sudo yum install -y nodejs
sudo yum install git
sudo npm install pm2@latest -g
wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
ln -s /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/bin/phantomjs
sudo yum install glibc fontconfig freetype freetype-devel fontconfig-devel wget bzip2
git clone https://github.com/TMTServices/pmf-pdfgeneration.git
cd pmf-pdfgeneration/
npm install
pm2 start index.html
pm2 log
