Question
· Sep 11, 2023

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?

Product version: IRIS 2021.1
Discussion (6)2
Log in or sign up to continue

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! 

Well, if your IRIS doesn't support Embedded Python you can do the following (if you are using a Linux Server):

  1. Install some application like ImageMagick in your server
  2. 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") 
  3. 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.