Pdf Converter is a container to convert PDF to PNG.
It will serve PNG images of PDF files on the file system. Using ACI enables mounting of Azure Storage File Share into the container, meaning we can directly convert from a PDF in Azure Storage to PNG.
Your PNG will be served at <your-ip-or-url>:5000/data-dir/path-to-file-in-fileshare/<page-number>.png?secret=1234&width=XXX&height=YYYY
The height and width query params are optional.
The secret is not optional. It defaults to 1234, but will be set as a random string if you use the ./scripts/create-aci.sh
script.
You must have docker installed to build the image locally.
cd pdfConverter
docker build -t <your-tag> .
Run the container locally:
docker run -p 8000:8000 <your-tag>
You'll see a static image served at:
http://localhost:3000/static-files/test.pdf/0.png?secret=1234
Download and install the Azure CLI.
Clone this repository
git clone <this.url>
Log into your Azure subscription.
az login
Set your subscription
az account set --subscription SUBSCRIPTION_ID
Hint: See your subscriptions with
az account list
Container Instances must be enabled on the subscription. Do that with az provider register --namespace Microsoft.ContainerInstance
If you have an existing Resource Group, you can skip this step.
Create an Azure Resource Group with the following command
az group create --location <location> --name <rg-name>
Hint: You can view available locations with
az account list-locations
./scripts/storage.sh <rg-name> <storage-account-name> <location>
./scripts/fileshare <rg-name> <storage-ac-name> <fileshare-name>
./scripts/create-aci.sh <rg-name> <storage-ac-name> <fileshare-name> <location>