Yes! You can use BuildVu with (almost) any programming language.
There are 2 ways you can integrate it with your language of choice. The first is using the command line, then the second involves hosting BuildVu on an application server and running it as a web service you can interact with via a REST API.
1. Via command line
You can run BuildVu directly from the command line, which means that as long as you have Java installed and your chosen language can interact with the command line, you’re good to go. For example, C# can use the Process class, Python can use subprocess, Ruby can use Kernel, etc.
For example, using Python:
from subprocess import call
cmd = 'java -jar path/to/buildvu.jar path/to/input.pdf path/to/output/directory'
This is a nice, quick and easy setup, but it doesn’t work for everyone. For some people, having Java installed, having to make sure your program is run from the same location as the buildvu jar or provide an absolute path to it isn’t an option – which brings us onto the second option.
2. Run BuildVu as a web service
Alternatively, you can now run BuildVu as a web service using our shiny new BuildVu Microservice Example, which you can interact with using almost any programming language through a simple REST API. Like the first option, no Java coding is necessary, but furthermore you don’t even have to have Java installed (except on the machine running BuildVu and the app server, of course).
It doesn’t take long to set up – all you need to do is:
- Clone the microservice example repository
- Build the .war file
- Deploy it to your app server of choice
That’s all – once you’ve done that you’re ready to go!
(We’ve written some tutorials that give you a step-by-step walkthrough of deployment depending on which app server you’re using.)
For example, if I’m using Ruby on Rails:
Install the gem using
gem install buildvu (or by adding it to my gemfile and using bundler)…
Add the following 3 lines of code…
buildvu = BuildVu.new('localhost:8080/microservice-example')
…and we’re done – my Rails app can now convert PDF to HTML5.
Furthermore, the libraries for each language and the BuildVu Microservice Example are all free and open source (excluding BuildVu itself – though the free trial works just fine too), so if you want to you can make changes, improvements, or simply play around with it. We’re open to pull requests!
Bonus: 3. Using a tool as a ‘bridge’ between languages
As mentioned in an article I wrote a while back – How to run Java applications from other programming languages – there are some great tools out there such as Py4J, IKVM & JRuby that allow 2 different languages to interact with each other using various different means. For example, Py4J communicates with the JVM using a local network socket, while JRuby runs on top of the JVM itself. If you don’t mind doing some coding or fancy a little challenge, this is something fun to explore!
Have you had any experience using multiple languages alongside each other like this before? We’d also love to hear your feedback – if we’ve missed your favourite app server or language, let us know in the comments below.