Printing an existing PDF saved to database Omnis 10

IT it at plastipol.com
Tue Mar 14 11:37:46 UTC 2023


Hi Max,

Under macos use lpr. pFichero the path to pdf document to print and an optional pCopias let you to print multiples copies.

regards

xavier


Begin text block
Text:lpr
If pCopias>1
Text: -#[pCopias]
End If
Text: '[pFichero]'
End text block
Get text block lvShellScript
Calculate lvShellScript as con('do shell script ';kDq;lvShellScript;kDq)
Do $runapplescript(lvShellScript) Returns lvError



> El 13 mar 2023, a las 17:55, Max Hattenback <maxh at carrubba.com> escribió:
> 
> I just tried it with 'print' instead of open and it seems like nothing happened sadly
> ________________________________
> From: omnisdev-en <omnisdev-en-bounces at lists.omnis-dev.com> on behalf of Mike Matthews - Omnis via omnisdev-en <omnisdev-en at lists.omnis-dev.com>
> Sent: Monday, March 13, 2023 12:53 PM
> To: OmnisDev List - English <omnisdev-en at lists.omnis-dev.com>
> Cc: Mike Matthews - Omnis <omnis at lineal.co.uk>
> Subject: Re: Printing an existing PDF saved to database Omnis 10
> 
> Hello Phil,
> 
> In our Windows code, we have #NULL where you have ‘print’.  So far, we only simply open the file, which might be the default option.  For OSX, we use  an AppleScript that Andy H worked up, so I’m looking at changing that verb from Open to print to see if it is that simple.
> 
> Maybe :)
> 
> Mike Matthews
> 
> Lineal Software Solutions
> Commercial House, The Strand<x-apple-data-detectors://1/1> Barnstaple, Devon, EX31 1EU<x-apple-data-detectors://1/1>
> 
> omnis at lineal.co.uk<mailto:mike.matthews at lineal.co.uk>
> 
> www.lineal.co.uk<http://www.lineal.co.uk/>
> 
> www.sqlworks.co.uk<http://www.sqlworks.co/>
> 
> 
> 
> On 13 Mar 2023, at 16:48, Phil (OmnisList) <phil at pgpotter.co.uk<mailto:phil at pgpotter.co.uk>> wrote:
> 
> Caution: This is a message which has originated from outside the organisation. Ensure the sender is trusted and the content is safe before opening links or attachments.
> 
> 
> 
> Hi Max,
> 
> Yes, that is what I was referring to...
> 
> Call DLL ('Shell32.dll','ShellExecuteW',0,'print',pPath,chr(0),chr(0),1)
> 
> 
> 
> regards
> Phil Potter
> Based in Chester in the UK.
> 
> On 13/03/2023 16:44, Max Hattenback wrote:
> Hi Phil,
> This file handler object doesn't have any methods that have to do with printing, I was thinking there might be some other similar DLL call I could use but I don't know what.
> ________________________________
> From: omnisdev-en<omnisdev-en-bounces at lists.omnis-dev.com<mailto:omnisdev-en-bounces at lists.omnis-dev.com>>  on behalf of Phil (OmnisList)<phil at pgpotter.co.uk<mailto:phil at pgpotter.co.uk>>
> Sent: Monday, March 13, 2023 12:41 PM
> To:omnisdev-en at lists.omnis-dev.com<mailto:omnisdev-en at lists.omnis-dev.com>  <omnisdev-en at lists.omnis-dev.com<mailto:omnisdev-en at lists.omnis-dev.com>>
> Subject: Re: Printing an existing PDF saved to database Omnis 10
> 
> Hi Max,
> 
> So its probably using:
> Register DLL ('Shell32.dll','ShellExecuteW','IJCCCCJ')
> 
> Call DLL ('Shell32.dll','ShellExecuteW',0,'Open',pPath,chr(0),chr(0),1)
> Assuming O$10 on a 64bit machine...
> 
> Have another method, and change the 'open' to 'print'...
> maybe
> 
> $PrintFileWithDefaultApp()
> 
> regards
> Phil Potter
> Based in Chester in the UK.
> 
> On 13/03/2023 16:35, Max Hattenback wrote:
> 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<mailto:omnisdev-en-bounces at lists.omnis-dev.com>>   on behalf of Phil (OmnisList)<phil at pgpotter.co.uk<mailto:phil at pgpotter.co.uk>>
> Sent: Monday, March 13, 2023 12:31 PM
> To:omnisdev-en at lists.omnis-dev.com<mailto:omnisdev-en at lists.omnis-dev.com>   <omnisdev-en at lists.omnis-dev.com<mailto: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<https://linkprotect.cudasvc.com/url?a=http%3a%2f%2fcarrubba.com&c=E,1,IZ6rnCjGvM5809vL4SIW2UO9h7u3zNLKsMrAt8aab5Dkzg3mb-K9ijTGuBKMWbAcyOvWxqBfNYcs1sg8-pAvwldHTUCRjs-bQi82gksriWGO&typo=1>
> 203-878-0605 ext. 215
> 
> [https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fcarrubba-image.s3-us-west-2.amazonaws.com%2flogo_smaller.png&c=E,1,UTPHtjIrwGbhpzTOhgy4i_-8z3rj-1-WQlycJQacoXmdEE2JwPGwhi418YriP8dBhK6AtlIGamrsmNJTpI7YZs0bs7aj5F4DFJOMdtUPzlkE4qINPdE,&typo=1]
> 
> 
> _____________________________________________________________
> Manage your list subscriptions athttps://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.omnis-dev.com&c=E,1,0KnxpaH3RtGogc1iLNCe3WJbpeIa7Snl-UhnVmVch44hAIk8VPXCvMN6tfhq-X6V7BLUyUYSruO82NyAyNecL3dDcLi9qtulKLBluiUr0j0,&typo=1
> Start a new message ->mailto:omnisdev-en at lists.omnis-dev.com
> _____________________________________________________________
> Manage your list subscriptions athttps://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.omnis-dev.com&c=E,1,o1yj0Keu8FcYT6HAO-nrb6q4SMlu5pka8zlTSOULphMq1m-QpcOGpuzU_NMZ-Kacv89zFNBV-QopIKIpEb5Khjo759xTuAyvFzObSk3Lvo8,&typo=1
> Start a new message ->mailto:omnisdev-en at lists.omnis-dev.com
> 
> [https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fcarrubba-image.s3-us-west-2.amazonaws.com%2flogo_smaller.png&c=E,1,VVB39gm_wWZvnpI27c9pjLXTf799qWT4AjByJ1YWETsVUvAMiAqQjMVUZQsU7G4lsMUBAkTFtKHQ8_D3DCTxIQVt3FEP__aXOEb0C1auWO-xyymXCQ6SAZE,&typo=1]
> 
> 
> _____________________________________________________________
> Manage your list subscriptions athttps://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.omnis-dev.com&c=E,1,KMnDtkPw19qxhEqVdnX8BKpMKrlKsDkkFRyEZ_Rw_43xKGZpcGtCa6MobMDRG_qnHWsS5MnQXwY0ZPdV2ktgP6KZ-3FHFXrHWkXSrwTwssfn&typo=1
> Start a new message ->mailto:omnisdev-en at lists.omnis-dev.com
> _____________________________________________________________
> Manage your list subscriptions athttps://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.omnis-dev.com&c=E,1,qE9_JDX_pSS1FI32UAVek89w5qNacHUbxqmWhHx0aRsWHy9Wxd8nXhdoiGbA46PArGsVpUED5e6ozIi2l-Pd4brC6CQoGHTPzLInqqedTQ,,&typo=1
> Start a new message ->mailto:omnisdev-en at lists.omnis-dev.com
> 
> [https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fcarrubba-image.s3-us-west-2.amazonaws.com%2flogo_smaller.png&c=E,1,MxI4BIHiEuLXvCAOvJ1tQXOCgzO2jyD4ZN-mzx7EjRz9OdFsK40RFgUuRpUtMrqNUSEUAtu8GhLpopNNYigUBYZFPkZyNTtGIH73ZcZPZrq-sivTBw,,&typo=1]
> 
> 
> _____________________________________________________________
> Manage your list subscriptions athttps://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.omnis-dev.com&c=E,1,kXjMFTvDZ9Nt1_RBk1ebZvAdgBW1hS2b_9QsIoc55sIaPtzSpG5fHGSH1O5YXHUO3-wOBL0Essj9En2hOSdhSH1tlH_CwEksKTsBG7VQEiY,&typo=1
> Start a new message ->mailto:omnisdev-en at lists.omnis-dev.com
> _____________________________________________________________
> Manage your list subscriptions at https://linkprotect.cudasvc.com/url?a=https%3a%2f%2flists.omnis-dev.com&c=E,1,GHpkcm6l_63WUqdTqBbhw4xDvt0fs2R8BogS3xUA5HUQCcL5v0tPnjnvh5f3oT1CC18plpim7dVQ9wodK1cZQdI0VL9yxu7aX9RY07UbVl_qxNw,&typo=1
> 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]
> 
> 
> _____________________________________________________________
> Manage your list subscriptions at https://lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 



More information about the omnisdev-en mailing list