If there's a text layer use LibreOffice to convert to txt (InterSystems IRIS wrapper), for OCR you'll need some thirdparty tool, for example Tesseract can be easily used with Embedded Python.

UPD: LibreOffice can't extract text from PDFs unfortunately. Here's Embedded Python solution:

Class User.PDF
{

/// 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)
    // pip3 install --target /data/db/mgr/python --ignore-requires-python typing==3.10.0.0
    try {
      set pypdf2 = $system.Python.Import("PyPDF2")
    } catch {
      set cmd = "pip3"
      set args($i(args)) = "install"
      set args($i(args)) = "--target"
      set args($i(args)) = dir
      set args($i(args)) = "PyPDF2==2.10.0"
      set args($i(args)) = "dataclasses"
      set args($i(args)) = "typing-extensions==3.10.0.1" 
      set args($i(args)) = "--upgrade"
      set sc = $ZF(-100,"", cmd, .args)
      set pypdf2 = $system.Python.Import("PyPDF2")
    }
    return:'$d(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
}

}

Try to reload like this:

set importlib = ##class(%SYS.Python).Import("importlib")
do importlib.reload(helloWorld)

Also, it not an IRIS-specific behavior, you'll get the same results in any python interpreter:

import helloWorld
helloWorld.helloWorld()
>'Hello world'
del helloWorld

# modify helloWorld.py in text editor

import helloWorld
helloWorld.helloWorld()
>'Hello world'

Will it run in the same Windows process?

Yes.

Will there be any issues with multitasking (considering python doesn't seem very good at this)?

GIL still exists and applies. If you write async code it would only be executed while control flow is on a python side of things. You can't spawn async task in python, go to InterSystems ObjectScript to do something else and then come to a completed python task.

Also, is there a performance penalty to pay for running embedded python vs "using IRIS APIs from Python". 

IRIS APIs from Python (Native SDK/Native API) can be invoked either in-shared-memory or over TCP. TCP comes with a performance penalty.

Another question is what python interpreter the embedded python is using? Is it an Intersystems one or the regular c.python?

CPython.

Version?

Use sys.version to check. Recently it was Python 3.9.5 on Windows and 3.8.10 on Linux.

Except that calling Python is about 10x slower, a

Not really, more like faster if you need to call it more than once:

 
Code

Results in:

 
Output

1. Yes. Stopping primary makes backup a new primary. Before stopping you might want to validate that backup is caught up:

set sql = "SELECT CASE WHEN DatabaseLatency=? THEN 1 ELSE 0 END IsCaughtUp FROM SYS.Mirror_MemberStatusList() WHERE CurrentRole = ?"
set rs = ##class(%SQL.Statement).%ExecDirect(,sql, "Caught up", "Backup")
do rs.%Next()
if rs.IsCaughtUp {
	write "Caught up"
	halt
} else {
	write "Not caught up"
	do $system.Process.Terminate(,1)
}

Or at least is not too far behind (check this post).

2.  No. ^MIRROR does the same.

There's a distinction between Background Jobs and Background Tasks.

Backgound job is anything you run using JOB command. Background Task is a limited set of named actions (AuditCopy, AuditExport, AuditPurge, Backup, CompactDBSpace, CopyNamespaceMappings, CreateDatabase, Compile, DatabaseIntegrityCheck, DataMigration, DefragmentDB, Delete, EnableEnsNamespace, Export, ExternalLangServers, FileMan, Import, SQLExport, SQLImport, SQLExportStatement, SQLImportStatement, QueryExport, JournalIntegrityCheck, LinkTable, LinkProcedure, MirrorActivateCatchupDB, MirrorRemoveDB, MirrorMountDB, MirrorAddDatabases, ModifyDatabaseSize, RebuildIndices, TuneTable, TuneTables, PurgeAllCachedQueries, JobShowPlan, JobSaveQuery, JobPossiblePlans, JobComparePlans, ShardActivate, ShardAssign, ShardVerify, ShardRebalance) runnable through a special interface. Docs.

You can run a Background Task (but probably should not  - it's a system action) by calling:

set parms("ClassName") = "Sample.Person"
set tSC = ##class(%CSP.UI.System.BackgroundTask).RunTask("RebuildIndices", "SAMPLES", .parms, .job)

As HIHLib.Support.GetHL7MessageStat:ISBListingQuery is not on the list you can't run it as a Background Task, but you can run it as a Job.

Next - no output. Note that you do not specify these parameters:

principal-input Principal input device for the process. The default is the null device.
principal-output
Principal output device for the process. The default is the device you specify for principal-input or the null device if neither device is specified.
UNIX®: If you do not specify either device, the process uses the default principal device for processes started with the JOB command, which is /dev/null.

Further:

Only one process can own a device at a time. This means that a job executing in a JOB Server is unable to perform input or output to your principal I/O devices even though you may close device 0.

So by default you run your job with stdio set to /dev/null and that's why there's no output.

You can either pass a device to write output to or write a wrapper which would handle the output and job that.