Sync orientation of header with document using pdfUtils



  • Dear jsReport Team,

    • There is one Header i use for all documents. The documents are landscaped dynamically by the api call.
    • I need the header to change orientation if the document does

    What i did so far is hand over a variable from the document to the header:

    Header:
       <script>  
         window.JSREPORT_CHROME_PDF_OPTIONS = {
           landscape: {{getOrientation this}}
         }
       </script>
    
    function getOrientation(page){
        return page.items[0]
    }
    
    Document:
    
    {{{pdfAddPageItem true }}}
    

    Of course this way the header is always landscaped. So I was searching for a document parameter to change true dynamically. I investigated @root but there is only my data and
    $resources,$resource,$localizedResources,$localizedResource,__appDirectory,__rootDirectory,__parentModuleDirectory

    Thank you for any kind of workaround.

    Cheers,
    Claus

    fyi:
    0_1621508633978_upload-b7afa7af-06c0-4e2c-8127-9bdf2fa4c384



  • How about passing the landscape information through the main data using custom script.
    See demo here
    https://playground.jsreport.net/w/anon/tApz4jtt



  • Thank you jan.

    It's working great. :)


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.