TOC Pdf-utils doesn't trigger



  • Hi I've followed your example for page-numbering for TOC (https://playground.jsreport.net/w/admin/akYBA4rS). But I don't seem to make it work, I've also copied the code from the playground example to a local project just to see so my project doesn't have any problems.

    The only two things that I can think about that are wrong:

    1. I haven't configure jsreport-pdf-utils correct to my project
    2. I'm using a trial license of jsreport

    Project setup:

    • jsreport 2.6.1
    • running on Mac OS
    • Recipe: Chrome-pdf
      "name": "jsreport-server",
      "scripts": {
        "start": "node server",
        "jsreport": "jsreport",
        "watch": "sass --watch ./styles/main.scss ./data/assets/styles.css/content.css"
      },
      "jsreport": {
        "entryPoint": "server.js"
      },
      "dependencies": {
        "axios": "^0.19.2",
        "fs": "0.0.1-security",
        "https": "^1.0.0",
        "jsreport": "2.6.1",
        "jsreport-pdf-utils": "^1.3.0",
        "lodash": "^4.17.15",
        "process": "^0.11.10"
      },
      "main": "server.js"
    } ```
    
    Do anyone have any suggestions on why this doesn't work?


  • This has nothing to do with licensing...

    Please try to export from playground and import it to your instance and test if it works.
    Right-click in playground entity tree, select export and then the same with import to your instance.



  • Thanks for the reply, I made it work with the playground example and successfully imported the functionality to my own project.

    It all worked from the begging, but I can see were it crashes. It's when I'm setting display header/footer to true.

    I tried to add a id to <span id="generated-{{id}}">{{getPage @root id}}</span>
    And then retrieve the innerHtml from the element with javaScript. However this doesn't work when I'm trying to console.log the element. What I'm getting is
    JSHandle@node. Do you know any solution for this?

    My idea is to fetch the elementById and then copy the text and display it to another div.

    Thanks in advance!



  • My idea is to fetch the elementById and then copy the text and display it to another div.

    Try to do this with handlebars templating engine. I don't see a reason why to do this with dom and javascript.



  • Alright, I'll try that. Thanks for the tip!


Log in to reply
 

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