showpdf

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Andrea Zen Andrea Zen 1 week, 4 days ago.

  • Author
    Posts
  • #10119
    Profile photo of Paul Mulroney Paul Mulroney 
    Participant

    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.

    #10121
    Profile photo of Andrea Zen Andrea Zen 
    Participant

    I’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))
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

© Omnis Software Ltd 2017 - Help with setup and design by Ädelfors Consult ABSweden Disclaimer: Omnis Software disclaims any responsibility for or liability related to Software, or any content or advice, obtained through this site. IN NO EVENT WILL OMNIS SOFTWARE BE LIABLE FOR ANY INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES HOWEVER THEY MAY ARISE AND EVEN IF OMNIS SOFTWARE HAS BEEN PREVIOUSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Log in with your credentials

or    

Forgot your details?

Create Account