Skip to content

finmars-platform/finmars-pdf-engine

Repository files navigation

README.md

# PDF Generation Service

This service provides an API for generating PDF documents from HTML content using Puppeteer.

## Prerequisites

Ensure you have Node.js installed on your system. You can download it from [nodejs.org](https://nodejs.org/).

## Installation

First, clone the repository and install the necessary dependencies:

```bash
npm install

Running the Server

To start the server on port 8080, run:

node server.js

This will launch the server and it will listen on http://localhost:8080. The primary endpoint for generating PDFs is:

POST /services/pdf-engine/print

Testing the Service

You can test the PDF generation service using the provided script. Ensure you have curl installed on your system to use the script. Run:

./test.sh

This script will make a POST request to the local server with a sample URL to generate a PDF.

Deployment

To build the Docker image and push it to your registry, run:

./update_image.sh

Ensure that you have Docker installed and configured correctly, and that you are logged into your Docker registry.

Notes

  • Update ./test.sh and ./update_image.sh with the correct commands according to your server configuration and registry details.
  • Adjust the environment variables and paths as necessary to fit your deployment environment.

### Creating Script Files

You need to create the `test.sh` and `update_image.sh` script files as mentioned in the README:

#### test.sh

```bash
#!/bin/bash
# Simple script to test the PDF generation service
curl -X POST http://localhost:8080/services/pdf-engine/print \
     -H "Content-Type: application/json" \
     -d '{"url": "https://example.com"}'

Make sure to give executable permissions:

chmod +x test.sh

update_image.sh

#!/bin/bash
# Script to build and push Docker image
docker build -t your-registry/your-image-name:tag .
docker push your-registry/your-image-name:tag

Again, set the executable permissions:

chmod +x update_image.sh

These scripts provide basic automation for testing and deploying your service. Adjust the content of the scripts based on your specific registry, tagging strategy, and payload requirements.

About

Open Source Finance Management Platform

Topics

Resources

License

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors