Can I use Asset in CSS too ?



  • I get the below exception when using asset in an in-line style tag -

    "Error rendering report: rendering has finished with errors:Error during rendering report: Unsupported asset encoding param value dataURI , supported values are base64, utf8, link, dataURI and string"

    This made me wonder can I use them in CSS or it needs to be in the <img> tag?

    Below is my HTML

    <!DOCTYPE html>
    <html>
    <head>
    <script>document.createElement("RepFront")</script>
    <script>document.createElement("PageDiv")</script>
    <script>document.createElement("Repo")</script>
    <style>
    RepFront {
    display: block;
    background-image: url("{#asset bgrd.png @encoding=base64 }");
    background-color: #aaaaaa;
    padding-top: 300px;
    padding-Left: 50px;
    font-size: 30px;
    widht:794px;
    height:1122px;
    font:Modeka;
    font-face {
    font-family: 'Modeka';
    src: url({#asset modeka.otf @encoding=dataURI});
    format('otf');
    }
    }
    </style>
    </head>
    <body>
    <RepFront><h1>{{product}}</h1>
    </RepFront>
    <PageDiv><div style='page-break-before: always;'></div></PageDiv>
    <Repo><h1>{{title}}</h1></Repo>
    <div><h2>{{sect}}</h2> </div>
    </body>
    </html>



  • The intent here is to have a front page which has a background image, a logo / custom font text, followed by the report with charts and text in next pages.



  • You can use assets everywhere. Maybe you should just try remove the space after the "dataURI ".
    If it won't help, please replicate a simplified form in playground so we can take a look.
    https://playground.jsreport.net



  • Yes, that worked. Thank you.
    I'm using jsreport.Local and jsreport.Binary in a c# app, It throws " Error rendering report: rendering has finished with errors:Error during rendering report: Asset modeka.otf not found "
    My folder structure is as below
    mainfolder > jsrep > assets > Modeka.otf



  • This post is deleted!

Log in to reply
 

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