TOC Show in Chrome-PDF hide in HTML



  • Hello

    I am new to JSReport and javascript so sorry if this is something already answered.

    I am using the same recipe to generate both Chrome-PDF and HTML.
    However the key difference is that I do not want to display the TOC in the HTML output.

    How do I set this up .

    Thank you



  • You can distinguish what recipe is used like this
    https://playground.jsreport.net/w/anon/N8~IKei5

    const jsreport = require('jsreport-proxy')
    function isHtmlRecipe() {   
        return jsreport.req.template.recipe === 'html'
    }
    

    Another option is to hide the content using css
    https://playground.jsreport.net/w/anon/cRGHVHR6

    <style>
        @media print
        {    
            .hideForPrint
            {
                display: none;
            }
        }  
    </style>
    <div class='hideForPrint'>
        Hello
    </div>
    


  • Thanks Jan
    Almost there

    Looking at option 2
    however I want to SHOW for Print and
    HIDE for HTML

    tried @media screen but both return blank

    can you help.

    Thank you in advance.



  • I would need a minimal playground demo to understand whats wrong.



  • Thanks Jan

    But looked into it a little further and applied the following and will adjust the min width accordingly.

    @media screen and (min-width: 100px)
    {    
        .hideForScreen
        {
            display: none;
        }
    }

Log in to reply
 

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