Automic Workload Automation

Expand all | Collapse all

Read Oracle Finance PDF Output file

Jump to Best Answer
  • 1.  Read Oracle Finance PDF Output file

    Posted 10-08-2019 07:56 AM
      |   view attached
    Hi all, I have a job in Auomic which will be executing a request in OEBS (Oracle Finance) and once the request done, it will generate a PDF output file.

    What I wanna do is: in the job's "Post Process", using the script to find a certain key work from the PDF output file. I know we can use "GET_PROCESS_LINE" function to read the text file, but how about reading the Output file in PDF and find for certain keywords?

    Any help or reading guide is appreciated. Thank you! :)

    ------------------------------
    Ken
    TX, Houston
    ------------------------------


  • 2.  RE: Read Oracle Finance PDF Output file

    Posted 10-08-2019 08:04 AM
    Hi.

    Automic ​does not include any native ability to parse (or search) PDF files, and you don't want to use any AutomicScript functions on binary files (such as PDF files), eventhough that might occasionally work it won't be reliable.

    You'd need to use one of various tools that convert PDF to text. Do a Google search for, for example, "pdf command line", there are various free and non-free, open or closed source tools for various operating systems. You then call the external tool of your choice as part of your job plan, then you can analyze the resulting plain text in various ways (grep, AutomicScript etc.).

    Hth,


  • 3.  RE: Read Oracle Finance PDF Output file

    Posted 10-08-2019 10:02 AM
      |   view attached
    Hi,

    Thank you for your reply! Really appreciate that.

    My another question is, when Oracle request completed, it will return the output file (.out) as per attached picture, are we able to get the file and read it? If yes, what would be the function?

    Any help or reading guide is appreciated. Thank you! :)

    ------------------------------
    Ken
    TX, Houston
    ------------------------------



  • 4.  RE: Read Oracle Finance PDF Output file

    Posted 10-08-2019 10:52 AM
    Hi.

    I'm not sure I fully understand the matter at hand. You can ​usually display the file directly from AWI using that download icon.

    There is a path starting with /opt/app on your screenshot. You should also be able to locate it in that path and open it as a plain text file, using vi or notepad or any editor really. That file is probably a plain text file, so you can process that one, unlike a PDF, using Automic's script language (e.g. line by line with :PREP_PROCESS_FILE).

    Hth,


  • 5.  RE: Read Oracle Finance PDF Output file

    Posted 10-08-2019 05:21 PM
    Thank you for your reply. Appreciate that! :)

    ------------------------------
    Ken
    TX, Houston
    ------------------------------



  • 6.  RE: Read Oracle Finance PDF Output file

    Posted 10-09-2019 01:25 AM
    You can identify the file in the post process using the command PREP_PROCESS_REPORTLIST. You might start with the below to identify the file:

    :SET &HND# = PREP_PROCESS_REPORTLIST()
    :PROCESS &HND#
    : SET &RH_TYPE# = GET_PROCESS_LINE(&HND#, 1)
    : SET &FILENAME# = GET_PROCESS_LINE(&HND#, 6)
    : PRINT "&TH_TYPE# - &FILENAME#"
    :ENDPROCESS
    :CLOSE_PROCESS &HND#

    To read the PDFs content I can recommend the "Convert-PDF" PowerShell module which is based on itextsharp. You can install it using install-module or have a peek view here https://www.powershellgallery.com/packages/ImportExcel/5.4.0

    It likely won't work with PowerShell Core so you must run it on a Windows machine. On Unix you might try to use the "strings" command which will try to extract any cleartext data from binary data. This might be enough for what you need.

    Regards
    Joel

    ------------------------------
    Swisscom & WorkflowCommander
    ------------------------------



  • 7.  RE: Read Oracle Finance PDF Output file

    Posted 10-09-2019 10:02 AM
    Dear Joel,

    Thank you for your reply! That give me the idea how to move on and I really appreciate it! :)

    ------------------------------
    Ken
    TX, Houston
    ------------------------------



  • 8.  RE: Read Oracle Finance PDF Output file
    Best Answer

    Posted 10-09-2019 10:06 AM
    > ​On Unix you might try to use the "strings" command

    That's pretty much what I meant by "eventhough that might occasionally work": Yes, you can usually extract ASCII strings from PDFs, with strings or by just gunning for it with grep or maybe even AutomicScript. But I would in no way rely on it. It's not guaranteed that your strings will be ASCII and in one piece throughout all versions and features of a PDF.

    Use dedicated software. I'm sure there's a Python module much like there is a PowerShell module.

    Best,
    Carsten


  • 9.  RE: Read Oracle Finance PDF Output file

    Posted 10-09-2019 10:14 AM

    I would give it a try ;-).


    ------------------------------
    Swisscom & WorkflowCommander
    ------------------------------



  • 10.  RE: Read Oracle Finance PDF Output file

    Posted 10-09-2019 10:46 AM
    Pah.




  • 11.  RE: Read Oracle Finance PDF Output file

    Posted 10-09-2019 11:13 AM
    Okay okay. Let's say: in cases where you know that a value must be extracted and there's a chance that the value would match an expected regexp or the value could be validated (i.e. by looking it up in a database), THIS WOULD DO THE JOB ;-)

    ------------------------------
    Swisscom & WorkflowCommander
    ------------------------------



  • 12.  RE: Read Oracle Finance PDF Output file

    Posted 10-10-2019 06:53 AM
    Thank you to both Mr.O and Mr.P! :)

    ------------------------------
    Ken
    TX, Houston
    ------------------------------



  • 13.  RE: Read Oracle Finance PDF Output file

    Posted 10-10-2019 08:40 AM
    You're very welcome :)​