Cannot Render Font through API (asset not found)



  • When I render the PDF in the playground with assets, it renders fine. However, if I use the API, I always get a 500 error with the following message:

    {"message":"Error during rendering report: Asset Roboto-Medium_7.woff not found"}

    Anyone solved this issue besides using cdn for assets?

    Thanks,

    Eric



  • Do you use the admin user in the API request?
    How does your api request looks like?



  • @jan_blaha

    {
    options: { 'Content-Disposition': 'attachment; filename=my_file.pdf' },
    template: { shortid: 'abc123' },
    data: {
    data1: 1,
    data2: 2
    }
    }

    I changed our template to use google Fonts, but now I have another problem. I have a background image that works fine in the playground but does not render at all when I download through API.


  • administrators

    is the background image an asset too? you do the request to your local jsreport instance (running in local port 5488), right? it is not clear to me what can be wrong in your case since i don't know what your template look like, try to write your template in playground and share it here. as far as i'm understanding your problem is that your template renders normally in playground but does not render when jsreport is running locally an consumed with the http API, is that right?



  • @bjrmatos No, I am using the cloud server.

    The background image is an asset and I include it as such:

    body {
    background: url("{#image businessCaseLtl.svg}") no-repeat fixed center;
    }



  • @bjrmatos Here is an example in playground mode with similar setup: https://playground.jsreport.net/studio/workspace/SyTqOqt3b/7


Log in to reply
 

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