I have got an answer while searching in community pages.

I have written below code , reading all text from pdf

Class PRASHANTHNSPKG.ReadPDF Extends %RegisteredObject

{

/// zw ##class(User.PDF).GetText("/tmp/example.pdf", .text)

ClassMethod GetText(file, Output text) As %Status

{

  Try {

    #dim sc As %Status = $$$OK

    Kill text

    Set dir = $SYSTEM.Util.ManagerDirectory()_ "python"

    Do ##class(%File).CreateDirectoryChain(dir)

   

    /// C:\InterSystems\IRISHealth\bin>irispip install --target C:\InterSystems\IRISHealth\mgr\python PyPDF2

    Try {

      Set pypdf2 = $SYSTEM.Python.Import("PyPDF2")

    } Catch {

      Set cmd = "irispip"

      Set args($INCREMENT(args)) = "install"

      Set args($INCREMENT(args)) = "--target"

      Set args($INCREMENT(args)) = dir

      Set args($INCREMENT(args)) = "PyPDF2"

      Set sc = $ZF(-100,"", cmd, .args)

      Set pypdf2 = $SYSTEM.Python.Import("PyPDF2")

    }

    Return:'$DATA(pypdf2) $$$ERROR($$$GeneralError, "Unable to load PyPDF2")

    Kill pypdf2

    Set text = ..GetTextPy(file)

  } Catch ex {

    Set sc = ex.AsStatus()

  }

  Quit sc

}

ClassMethod GetTextPy(file) [ Language = python ]

{

  from PyPDF2 import PdfReader

  reader = PdfReader(file)

  text = ""

  for page in reader.pages:

    text += page.extract_text() + "\n"

  return text

}

}

Thanks, Julius Kavay

ENCODE to base64 is working for me now as per your suggested code snippet.

Here I have another issue after the conversation.

I need to send the converted string in the JSON property "Filecontent" to the REST outbound.

FilecontentdataType is String, which exceeds the size when I assign this converted stream to String.

I have changed the Filecontent dataType to Stream, but when I convert the object to JSON ,  it is ignoring this property.

could you please any suggestions will be very much helpful?

thanks,

Prashanth

thanks Robert ,

seems scope is not a problem , just I have changed in where condition Status='5'  

sql(SELECT count(ID) into :suspendedCount FROM Ens.MessageHeader where TargetQueueName not like '_S%' and TargetQueueName not like 'ENS%' and Status='5')

working fine

but same query  resulting 0 records in sql explorer, and revert the where condition working fine in sql explorer

why the difference where condition requiring for @sql ,sql explorer

thanks a lot,

Prashanth

Hi Utsavi,

It is possible by implementing monitoring integration (business service, business Process as Router, Business Operation as rest call) and deploying in the same production.

1) Implement Customised Business service which triggers by every 5 min (this you can configure) to call methods fr each of your requirement and get the data from cache and prepare the respective type of message and call Business Rules engine.

Example Methods:

1)getHeartbeat()  method  fetch the currently running version of production and namespace and prepared customised heartbeat message and send to the Rules engine

2) getQueuestatus() this method fetches the interested queues info from the cache and prepare the new message for each queue and send it to the business rules engine

3)getInactivity() this method gets all inactive processes and prepares the new message for each process and sends them to the rules engine.

create as many methods as per your requirement.

Now in business service write rules for each type of message, and check respective values are reaching threshold value (if needed ) then send message to Rest endpoint using Business Operation.

This rest service will read the messages and stored them in a web application database.

Web application Shows the summary of the data and refreshes every 5 minutes.

This way, whatever monitoring values using ENSLIB class methods you can read using cache script by calling embedded SQL, All readings you can show in your web page.

If production is down, As this integration is the same production, your heartbeat messages also missing in next 5 min with other messages. You can build logic in a webpage, if the heartbeat is older than 5 min, shows in the web app as Production down.

Hope this idea helpful to you , we did the same way for our monitoring requirement

Thanks,

Prashanth P