Git Product home page Git Product logo

quarkus-pdf-extract's Introduction

Quarkus PDF Extract

An example microservice which extracts the text contents of uploaded PDF files.

It is built using Quarkus and uses Apache PDFBox as well as Jonathan Link's PDFLayoutTextStripper.

Building and Running the Service

This service is intended to be run as a native Linux binary via GraalVM. Build the binary like so:

./mvnw package -Pnative -Dnative-image.container-runtime=docker

Then create a Docker container with the binary:

docker build -f src/main/docker/Dockerfile.native -t quarkus-examples/quarkus-pdf-export .

Run the container:

docker run -i --rm -p 8080:8080 -e PORT=8080 quarkus-examples/quarkus-pdf-export

Invoking the Service

To invoke the service, e.g. use httpie like so (adjust the file name to a PDF on your hard disk):

http -f POST localhost:8080/extract uploadedFile@"/path/to/some/file.pdf" -d

This will create a file extracted.txt with the extracted text in the current directory.

Running on Google Cloud Run

The Quarkus-built native binary is a perfect fit for Serverless environments such as Google Cloud Run. Follow the steps in the Google Cloud Run documentation for setting up Cloud Run and the Google Cloud SDK.

Submit a build of the Docker container to the Google Container Registry:

rm -rf target/reports
gcloud builds submit --tag gcr.io/<your project id>/quarkus-pdf-extract

Then deploy an instance of the service to Cloud Run:

gcloud beta run deploy --image gcr.io/<your project id>/quarkus-pdf-extract

You can then invoke the service as shown before, replacing localhost:8080 with the endpoint shown in the output of the deploy command (similar to https://quarkus-pdf-extract--uc.a.run.app).

quarkus-pdf-extract's People

Contributors

gunnarmorling avatar

Watchers

James Cloos avatar Chakra avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.