Tagged: $clientcommand, jsClient, showpdf
This topic contains 2 replies, has 2 voices, and was last updated by Paul Mulroney 3 years ago.
-
AuthorPosts
-
April 18, 2017 at 8:58 am #10119
Hi Everyone,
I’m working on a jsClient prototype. Have a “Print” button that I want to generate a PDF, and then display it in the browser.
The Omnis Web Dev manual says that there are two ways to do this – “showpdf” and “assignpdf”. Show PDF is supposed to either show it in a new window, or open another tab and display the PDF there. So far, no luck.
“AssignPDF” seems to work, but then that means I have to add a HTML object to my form to display it – I’d like to avoid that if possible.
Along the way, I’ve updated my config.json so that it includes the following in the “Servers” section (for testing purposes, the final dirs will change):
"getpdfFolders": [ "/Users/paul/Desktop", "/Applications/Omnis Studio 8.0.2 x64.app/Contents/MacOS" ]
So, this bit of code works, but requires a HTML object on the form:
Do $cinst.$clientcommand('assignpdf',row('oHTML','toolbar=1&zoom=20','/Users/paul/Desktop/pdf_50418_1492480139_5.pdf',300))
This bit of code is supposed to work, but it doesn’t:
Do $cinst.$clientcommand('showpdf',row('/Users/paul/Desktop/pdf_50418_1492480139_5.pdf',60)) ;; Display the PDF, wait 60 seconds
Has anyone used “showpdf” before, and is there any special trick to make it work?
Thanks in advance,
Paul.A man rushed into the doctor’s office and shouted, “Doctor! I think I’m shrinking!”
The doctor calmly responded, “Now, settle down. You’ll just have to be a little patient.”Paul W. Mulroney
We Don't Do Simple Pty Ltd
ACN 161 009 374
Bentley Western Australia 6102April 18, 2017 at 9:43 am #10121I’ve used it this way and it works; the browser (Firefox) opens the PDF in a new tab (after you allow to open pop-ups):
Calculate lcdevice as $cdevice.$ident ;; store current print destination Do $cdevice.$assign(kDevOmnisPDF) Do Omnis PDF Device.$settemp(kTrue,1) Returns lID Set report name YOUR_REPORT_CLASS Print report {YOUR_REPORT_CLASS (your parameters...)} Do $cdevice.$assign(lcdevice) ;; restore print destination Do $cinst.$clientcommand("showpdf",row(lID))
January 15, 2018 at 3:17 am #13199I figured out the problem – showpdf() doesn’t work if you have “block popups” enabled on your browser.
A man rushed into the doctor’s office and shouted, “Doctor! I think I’m shrinking!”
The doctor calmly responded, “Now, settle down. You’ll just have to be a little patient.”Paul W. Mulroney
We Don't Do Simple Pty Ltd
ACN 161 009 374
Bentley Western Australia 6102 -
AuthorPosts
You must be logged in to reply to this topic.