How would one convert a PDF to an image using Ensemble/IRIS
Suppose I have a PDF and I need to convert it to an IMAGE (it can be a JPG or PNG)
Does anyone have an idea?
Comments
This sounds like a classic example of leveraging embedded Python in IRIS to make use of the very large volume of python libraries that do just about anything :) Here is an article that I found on a quick Google search on how to do this in Python:
https://www.geeksforgeeks.org/convert-pdf-to-image-using-python/
You could just leverage the Python capabilities of InterSystems IRIS to make use of how this problem has been solved in Python!
Hi Ben Spead! thank you very much for the tip!
Unfortunately my environment is not ready to use the embedded Python.
I'm thinking about doing file conversions, but I'm in a hurry to resolve this issue and I don't know where else to go.
In that case, install Python on your machine with the library you want to use, and call $zf(-100) to execute your python script. Later when you upgrade your environment you can move to using embedded Python directly.
Well, if your IRIS doesn't support Embedded Python you can do the following (if you are using a Linux Server):
- Install some application like ImageMagick in your server
- From your Business Operation use $ZF(-100) function to execute in the server the magick command to convert the PDG to JPG, something like:
$ZF(-100,"","magick","\usr\image.pdf","\usr\image.jpg") - Maybe it takes some time to finish, you can wait to the end of the execution or just create a business service to get all the new pdf files.
I think this is the quickest alternative solution. Thank you very much Luis Angel!
What can I say...
