Downloaded pdf with renderAsync not opening



  • jsreport.renderAsync(reportRequest).then(function(res) {
                if(type == "reprot_download"){
                    res.download('probing_report.pdf')
                }
    }
    


  • Please try to handle the failed promise with catch, does it return any error?
    Check also F12 browser tools and check network and console. Are there some errors?



  • I have logged the result as string like res.toString(). It's printing full HTML.
    with res. download pdf is downloaded but when I open this is saying " File type HTML document (text/html) is not supported". this is my full code:

    jsreport.serverUrl = 'URL';
    let reportRequest = {
    template: {
    shortid: this.state.template.id
    },
    data:{
    "probing_data": this.state.probingList
    },
    };

        let _this = this
        jsreport.renderAsync(reportRequest).then(function(res) {
            if(type == "report_generate"){
                res.toString()
                _this.setState({
                    showReportSection:true,
                    displayPdfHtml:res.toString()
                })
            }
            if(type == "reprot_download"){
                res.download('probing_report.pdf')
            }
        });


  • It seems your template has the wrong recipe when it is rendering HTML. Check it out in the jsreport studio.



  • Thank!. it is html-with-browser-client. which should i use instead?



  • Please check the documentation
    https://jsreport.net/learn/recipes

    Probably the chrome-pdf one.



  • Thank you!


Log in to reply
 

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