Maximo

 View Only
Expand all | Collapse all

To Read PDF file ( This PDF file is a report file) from Server path and Convert it in to BLOB message using Automation Script.

  • 1.  To Read PDF file ( This PDF file is a report file) from Server path and Convert it in to BLOB message using Automation Script.

    Posted Thu June 23, 2022 02:06 PM
    Hi

    I have a requirement where I need to read PDF file ( This PDF file is a report file) from Server path and Convert it in to BLOB message using Automation Script.
    and Publish the BLOB message to Message queue so that it could send to Webmethods.


    If Somebody has worked on such requirement .Please suggest.

    ------------------------------
    Reetika Agrawal
    ------------------------------



    #MaximoIntegrationandScripting
    #Maximo
    #AssetandFacilitiesManagement


  • 2.  RE: To Read PDF file ( This PDF file is a report file) from Server path and Convert it in to BLOB message using Automation Script.

    Posted Tue September 26, 2023 05:20 PM

    Hi Reetika,

    Have you got this working, if yes. Can you please let me know the process.

    Thanks.



    ------------------------------
    Gajender kumar
    ------------------------------



  • 3.  RE: To Read PDF file ( This PDF file is a report file) from Server path and Convert it in to BLOB message using Automation Script.

    IBM Champion
    Posted Tue September 26, 2023 05:33 PM

    Here is an example of reading a file to a byte array (Blob) and from there you can do what you need to do.

    JavaScript:

    Files = Java.type("java.nio.file.Files");
    Path = Java.type("java.nio.file.Path");
    Paths = Java.type("java.nio.file.Paths");
    
    main();
    
    function main(){
        // get your byte array (BLOB) and do whatever you need to with it.
        var bytes = Files.readAllBytes(Paths.get("/path/to/file"));
    }

    Python:

    from java.nio.file import Files, Path, Paths
    
    def main():
        # get your byte array (BLOB) and do whatever you need to with it.
        bytes = Files.readAllBytes(Paths.get("/path/to/file"))
    }
    
    main()


    ------------------------------
    Jason VenHuizen
    https://sharptree.io
    https://opqo.io
    ------------------------------