Printing an existing PDF saved to database Omnis 10

Max Hattenback maxh at
Mon Mar 13 16:35:30 UTC 2023

Hello Phil,
This is for PC. Here is the code i'm using to fetch the PDF Bin from the database and then open it in adobe.

Do PackingSlipDocList.$GetAllRecords(con('WHERE invoice_number = ',iHeaderRow.INVOICE_NUMBER,'AND document_type_id = 9'))

Calculate Path as $ctask.tGlobals.$getTempDocPath

Calculate Path as con(Path,sys(9),PackingSlipList.DOCUMENT_NAME,'.pdf')

Do FileOpsObject.$CreateFile(Path) Returns %%err

Do FileOpsObject.$writefile(PackingSlipDocList.SAVED_DOCUMENT) Returns %%err

Do FileOpsObject.$openfile(Path)

Do FileOpsObject.$closefile()

Do FileHandlerObject.$OpenFileWithDefaultApp(Path)

Inside $OpenFileWithDefaultApp()

If sys(6)='M'|sys(6)='X'

Calculate #F as $runapplescript(con('tell application "Finder" to open "',pPath,'"'))


If isunicode()

Register DLL ('Shell32.dll','ShellExecuteW','IJCCCCJ')

Call DLL ('Shell32.dll','ShellExecuteW',0,'Open',pPath,chr(0),chr(0),1)


Register DLL ("shell32.dll","ShellExecuteA","JJCCCCJ") Returns %%err

Call DLL ("shell32.dll","ShellExecuteA",0,"open",pPath," "," ",1) Returns %%err

End If

End If

From: omnisdev-en <omnisdev-en-bounces at> on behalf of Phil (OmnisList) <phil at>
Sent: Monday, March 13, 2023 12:31 PM
To: omnisdev-en at <omnisdev-en at>
Subject: Re: Printing an existing PDF saved to database Omnis 10

Hi Max,

You don't say Mac or PC, but probably doesn't matter...

When you would normally open the pdf... do you issue some 'open' command?
Can you just change it to a 'print' command?

Phil Potter
Based in Chester in the UK.

On 13/03/2023 16:08, Max Hattenback wrote:
> Hello Everyone,
> We upload PDFs into our postgres database as binaries, I am able to within Omnis load the data from the PDF, write a file to the local machine and then open the PDF in the default application for PDFs. However, there are scenarios where I would rather send the PDF directly to a printer, so the user doesn't have to make an extra input to print from adobe, is this possible?
> Max Hattenback
> Sr. Manager, Information Technology
> Carrubba Inc<>
> 203-878-0605 ext. 215
> []
> _____________________________________________________________
> Manage your list subscriptions at
> Start a new message ->mailto:omnisdev-en at
Manage your list subscriptions at
Start a new message -> mailto:omnisdev-en at


More information about the omnisdev-en mailing list