Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ry Blaisdell
    @rylincoln
    :wave: hola - i am trying to get the permanent link header from response but having trouble here - reading here
    jsreport.renderAsync({
        template: {
          shortid: reportalObj[i].js_short_id
        },
        data: payload,
        options: {
          reports: {
            save: true,
            blobName: name
          }
        }
      })
        .then(res => {
          res.headers
        })
    results in undefined
    Jan Blaha
    @pofider
    please try this
    res.xhr.getResponseHeader('Permanent-Link')
    Ry Blaisdell
    @rylincoln
    oh man - so close it's there i think but Refused to get unsafe header "Permanent-Link"
    i'll google that
    Ry Blaisdell
    @rylincoln
    access-control-allow-origin: *
    access-control-expose-headers: *
    connection: keep-alive
    content-disposition: inline;filename=Maine Vernal Pool Assessment.pdf
    content-type: application/pdf
    date: Wed, 20 May 2020 20:58:10 GMT
    server: nginx/1.14.0 (Ubuntu)
    transfer-encoding: chunked
    x-powered-by: Express
    x-xss-protection: 0
    this was reply from res.xhs.getAllResponseHeaders();
    don't see the permalink but do see the filename
    oh wait - nevermind
    i'm an idiot - i forgot i switched branches with diff code here
    Ry Blaisdell
    @rylincoln
    Thanks, Jan, it all works as expected now.
    gaurav porwal
    @gauravprwl14

    Hey Everyone, I am using JSreport for production and it is deployed in Heroku with 1x dyno
    But app keep crashing when 11 concurrent requests are made. I am unable to figure out what is the root issue

    I am using the default jsreport.config.json

    {
      "extensions": {
      "httpPort": 5488,
      "httpsPort": null,
      "store": {
        "provider": "fs"
      },
      "blobStorage": {
        "provider": "fs"
      },
      "logger": {
        "console": {
          "transport": "console",
          "level": "debug"
        },
        "file": {
          "transport": "file",
          "level": "info",
          "filename": "logs/reporter.log"
        },
        "error": {
          "transport": "file",
          "level": "error",
          "filename": "logs/error.log"
        }
      },
      "allowLocalFilesAccess": true,
      "templatingEngines": {
        "timeout": 10000,
        "numberOfWorkers": 12,
        "strategy": "http-server",
        "templateCache": {
          "max": 100,
          "enabled": true
        }
      },
      "chrome": {
        "timeout": 40000,
        "strategy": "chrome-pool",
        "numberOfWorkers": 12,
        "launchOptions": {
          "args": [
            "--no-sandbox"
          ]
        }
      }
    }
    can someone help me with the configuration
    BJR Matos
    @bjrmatos

    hi @gauravprwl14

    hmm the configuration file looks wrong, it should be more like this:

    {
      "httpPort": 5488,
      "httpsPort": null,
      "store": {
        "provider": "fs"
      },
      "blobStorage": {
        "provider": "fs"
      },
      "logger": {
        "console": {
          "transport": "console",
          "level": "debug"
        },
        "file": {
          "transport": "file",
          "level": "info",
          "filename": "logs/reporter.log"
        },
        "error": {
          "transport": "file",
          "level": "error",
          "filename": "logs/error.log"
        }
      },
      "allowLocalFilesAccess": true,
      "templatingEngines": {
        "timeout": 10000,
        "numberOfWorkers": 12,
        "strategy": "http-server",
        "templateCache": {
          "max": 100,
          "enabled": true
        }
      },
      "extensions": {
        "chrome": {
          "timeout": 40000,
          "strategy": "chrome-pool",
          "numberOfWorkers": 12,
          "launchOptions": {
            "args": [
              "--no-sandbox"
            ]
          }
        }
      }
    }

    however i don’t know if this is the real file you are using or you just copied it wrong here

    as per the 11 concurrent requests problem hmm i don’t have a good explanation, it will be really weird the jsreport produces this alone, i guess this is a problem with some configuration in Heroku, are there no logs available in the Heroku side?

    or maybe there are also some jsreport logs that you can share when does request are made, if it breaks at jsreport side you should be able to get some logs in logs/error.log
    gaurav porwal
    @gauravprwl14
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.387Z - debug: Base url not specified, skipping its injection.
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.403Z - debug: Replaced assets ["Helvetica.otf"]
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.405Z - debug: Rendering engine handlebars
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.414Z - debug: Replaced assets ["Helvetica.otf"]
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.417Z - debug: Rendering engine handlebars
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.429Z - debug: Replaced assets ["Helvetica.otf"]
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.430Z - debug: Rendering engine handlebars
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.565Z - debug: Compiled template not found in the cache, compiling
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.570Z - debug: Executing recipe chrome-pdf
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.699Z - debug: Compiled template not found in the cache, compiling
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.708Z - debug: Compiled template not found in the cache, compiling
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.711Z - debug: Compiled template not found in the cache, compiling
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.724Z - debug: Compiled template not found in the cache, compiling
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.794Z - debug: Compiled template not found in the cache, compiling
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.796Z - debug: Compiled template not found in the cache, compiling
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.797Z - debug: Executing recipe chrome-pdf
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.798Z - debug: Executing recipe chrome-pdf
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.798Z - debug: Executing recipe chrome-pdf
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.800Z - debug: Compiled template not found in the cache, compiling
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.803Z - debug: Executing recipe chrome-pdf
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.806Z - debug: Executing recipe chrome-pdf
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.807Z - debug: Executing recipe chrome-pdf
    May 25 04:01:10 airops-reporting-staging app/web.1 2020-05-25T11:01:10.809Z - debug: Executing recipe chrome-pdf
    May 25 04:01:11 airops-reporting-staging app/web.1 2020-05-25T11:01:11.202Z - debug: Converting with chrome HeadlessChrome/79.0.3945.0 using chrome-pool strategy
    May 25 04:01:11 airops-reporting-staging app/web.1 2020-05-25T11:01:11.430Z - debug: Converting with chrome HeadlessChrome/79.0.3945.0 using chrome-pool strategy
    May 25 04:01:11 airops-reporting-staging app/web.1 2020-05-25T11:01:11.486Z - debug: Converting with chrome HeadlessChrome/79.0.3945.0 using chrome-pool strategy
    May 25 04:01:14 airops-reporting-staging app/web.1 #1 0x55e7300d3ee3 base::debug::StackTrace::StackTrace()
    May 25 04:01:14 airops-reporting-staging app/web.1 #3 0x55e73014225f base::SimpleThread::Start()
    May 25 04:01:14 airops-reporting-staging app/web.1 #4 0x55e72e910a72 content::SandboxHostLinux::Init()
    May 25 04:01:14 airops-reporting-staging app/web.1 #8 0x55e72fd5a9dd headless::(anonymous namespace)::RunContentMain()
    May 25 04:01:14 airops-reporting-staging app/web.1 #9 0x55e72fd5a73b headless::HeadlessShellMain()
    May 25 04:01:14 airops-reporting-staging app/web.1 #12 0x55e72da1f0aa _start
    May 25 04:01:14 airops-reporting-staging app/web.1 #0 0x55e73016fe29 base::debug::CollectStackTrace()
    May 25 04:01:14 airops-reporting-staging app/web.1 #1 0x55e7300d3ee3
    Cleadon
    @hep99_twitter
    Hi, I'm trying to use PDFUtils to add a footer using a docker image of jsReports and an azure app that remotely accesses the docker image. I'm using this code.
    HttpContext.JsReportFeature()
    .Recipe(Recipe.ChromePdf)
    .Engine(Engine.Handlebars)
    .Configure((r) => r.Template.Chrome = new Chrome {
    Format = "A4"
    })
    .Configure((r) =>
    {
    r.Template.PdfOperations = new[]
    {
    new PdfOperation()
    {
    Template = new Template
    {
    Content = strHeaderFooterHtml,
    Engine = Engine.None,
    Recipe = Recipe.ChromePdf,
    Chrome = new Chrome {Format = "A4"}
    },
    Type = PdfOperationType.Merge
    },
    new PdfOperation()
    {
    Template = new Template
    {
    Content = strCoverHtml,
    Engine = Engine.None,
    Recipe = Recipe.ChromePdf,
    Chrome = new Chrome {Format = "A4"}
    },
    Type = PdfOperationType.Prepend
    }
    };
                });
    the standard header footer from https://playground.jsreport.net/w/admin/kMI4FBmw
    but I see this rendered on the page.. {{#each $pdf.pages}}{{#if @index}}
    I pass the HTML for header/footer as a string of the actual html
    Jan Blaha
    @pofider
    when you set Engine = Engine.None, then no engine is used tags like {{#each}} will just stay as strings
    you likely want to use Engine.Handlebars for the header merge operation
    Cleadon
    @hep99_twitter
    of course... thanks
    Cleadon
    @hep99_twitter
    I'm getting a strange error. Passing the helpers in as a string from..
    new PdfOperation()
    {
    Template = new Template
    {
    Content = strHeaderFooterHtml,
    Helpers = strHeaderFooterHelper,
    Engine = Engine.Handlebars,
    Recipe = Recipe.ChromePdf,
    Chrome = new Chrome {Format = "A4"}
    },
    Type = PdfOperationType.Merge
    }
    gives An unhandled exception has occurred while executing the request.
    Error while executing pdf-utils operations. Error while executing templating engine. Unexpected token 'return'

    the string is

    function getPageNumber (pageIndex) {
    if (pageIndex == null) {
    return ''
    }

    const pageNumber = pageIndex + 1
    
    return pageNumber

    }

    function getTotalPages (pages) {
    if (!pages) {
    return ''
    }

    return pages.length

    }

    Jan Blaha
    @pofider
    please use here code highlighting, it is otherwise hard to read
    otherwise the string looks good, not sure what is the problem, maybe some wrong escaping
    Cleadon
    @hep99_twitter
    thanks, will make sure all code in highlighted in future
    You were right, now working
    zewar96
    @zewar96
    Is it better to post in here or on the Forums? I already posted my question on the forum (https://forum.jsreport.net/topic/1665/jsreport-types-missing) but i am not sure which is monitored more
    Jan Blaha
    @pofider
    Hi, I answer on forum
    zewar96
    @zewar96
    @pofider Thank you. i will use that and not clog up both with the same question.
    Hussain
    @hussainb

    Hi... I am trying to access the $pdf object in my handlebars template so that I can write conditional logic for the PDF header based on the pageNumber..... but I am unable to manage to get the $pdf variable working... it probably seems to stay undefined... I tried different ways but I am not able to make it work... PLEASE SOMEONE KINDLY HELP ME..

    more info: using jsreport-core https://github.com/jsreport/jsreport-core in nodejs

    mohamedmonirshabana
    @mohamedmonirshabana
    how i can add fix header and footer to jsreport when data increase add another page
    mohamedmonirshabana
    @mohamedmonirshabana
    i create report in jsreport studio i ake a design by html to generate PDF there is a part of HTML i need to fix it in all document like header and footer
    Jan Blaha
    @pofider
    I'm sorry but I am a bit lost in your question. Please try to reformulate it and elaborate more
    Bruce McElroy
    @visualbam
    Hello friends. I've updated from 2.6 to 2.10. I've set up a header/footer and use the options in studio to merge them. Then I set up toc to be merged in an afterRender function. This was working fine in 2.6. In 2.10, this breaks my page numbers in the toc. If I merge the toc via studio, it works as expected. I can't seem to tell why
    Jan Blaha
    @pofider
    Could you do a minimal zip with export that replicates this and upload it somewhere?
    Bruce McElroy
    @visualbam
    Sure thing! Will come back when I get a chance to do that!
    Bruce McElroy
    @visualbam

    I'm back! I was able to reproduce this using the toc template. Using 2.10.0 you'll notice that the page numbers don't display on the toc. If you run this using 2.6.0 and 1.5.1 pdf-utils, they display fine.

    https://playground.jsreport.net/w/visualbam/Tj6QHPJq

    Bruce McElroy
    @visualbam
    Curious if anyone was able to look at the issue I mentioned? Want to make sure it's not something I'm simply overlooking or using it in a non-intended way
    Jan Blaha
    @pofider
    Hi @visualbam
    I need to give it some more thoughts tomorrow, but I already give you some info. The problem you experience was introduced by this jsreport/jsreport#626
    because the script afterRender runs after the pdf utils, you don't see the hidden information and cannot calculate the pdf page numbers properly
    we were aware of this so we introduced the solution here