Printing an existing PDF saved to database Omnis 10
Max Hattenback
maxh at carrubba.com
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,'"'))
Else
If isunicode()
Register DLL ('Shell32.dll','ShellExecuteW','IJCCCCJ')
Call DLL ('Shell32.dll','ShellExecuteW',0,'Open',pPath,chr(0),chr(0),1)
Else
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 lists.omnis-dev.com> on behalf of Phil (OmnisList) <phil at pgpotter.co.uk>
Sent: Monday, March 13, 2023 12:31 PM
To: omnisdev-en at lists.omnis-dev.com <omnisdev-en at lists.omnis-dev.com>
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?
regards
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<http://carrubba.com>
> 203-878-0605 ext. 215
>
> [https://carrubba-image.s3-us-west-2.amazonaws.com/logo_smaller.png]
>
>
> _____________________________________________________________
> Manage your list subscriptions athttps://lists.omnis-dev.com
> Start a new message ->mailto:omnisdev-en at lists.omnis-dev.com
_____________________________________________________________
Manage your list subscriptions at https://lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com
[https://carrubba-image.s3-us-west-2.amazonaws.com/logo_smaller.png]
More information about the omnisdev-en
mailing list