Dynamic Image not rendering on pdfs

  • We're trying to create several documents for our program where the logo could be different across any or all users of said program. We store the files on our end, get the file url, and send it to the jsreport server, along with some other data. For whatever reason, despite our best attempts to solve this issue, the image doesn't load at all, just a little square box. In fact, even if we hard code an image url into the jsreport, it still does the same thing.

    Tried to search your documentation as well as the forums to no avail. Any help would be nice

  • administrators

    hi! can you please make an example of your problem here, save it and then share it with us? it would help a lot in order to give you some advice

  • https://playground.jsreport.net/studio/workspace/B1uxZyioW/7

    It seems to work here, but not on our production server

  • Can you try it without using https? Can you try whatever another image then yours? Can you run the template with Debug button and give us the log? I guess it works for you if you run it with html recipe, right? Don't you use a proxy on the production server?

  • When we removed https from the image on our server it seemed to work, is there anyway we can still use https? Our server redirects everything to https.
    Https also does work with the html recipe instead, but we want it to be pdf, and we don't use a proxy.

    Here's the debug log:

    +0 Starting rendering request 12
    +0 Rendering template {shortid:BkXOtj5jb, recipe:phantom-pdf,engine:handlebars}
    +0 Adding sample data HycvXJii-
    +1 Resources not defined for this template.
    +1 Rendering engine handlebars
    +21 Taking compiled template from engine cache
    +22 Replaced images []
    +23 Executing recipe phantom-pdf
    +24 Converting in http server based phantomjs 1.9.8
    +25 Request file:///%2Fvar%2Fwww%2FTracxTMS%2Fjsreport-temp%2F5b5b4210-a491-11e7-a487-1b30c088e57fhtml.html
    +26 Request https://lh4.googleusercontent.com/-v0soe-ievYE/AAAAAAAAAAI/AAAAAAADwkE/KyrKDjjeV1o/photo.jpg
    +34 Unable to load resource (#17URL:https://lh4.googleusercontent.com/-v0soe-ievYE/AAAAAAAAAAI/AAAAAAADwkE/KyrKDjjeV1o/photo.jpg)
    +34 Error code: 99. Description: Error creating SSL context (error:140A90C4:SSL routines:func(169):reason(196))
    +59 phantom-pdf recipe finished with 1 pages generated
    +59 Skipping storing report.
    +60 Rendering request finished 12

  • administrators

    hmm for some reason phantomjs is failing when creating a https request and that is weird.., what OS your server has? what version of jsreport are you using? can you try in another different machine and see if it works?

  • administrators

    also please share here your jsreport config.

  • Ubuntu 16.04
    jsreport 1.7.0 development (We think)

    jsreport config:

    "httpsPort": 3000,
    "certificate": {
    "key": "",
    "cert": "
    "authentication": {
    "cookieSession": {
    "secret": "i have no idea"
    "admin": {
    "username": "",
    "password": "
    "enabled": true
    "connectionString": {
    "name": "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"
    "blobStorage": "fileSystem",
    "phantom": {
    "allowLocalFilesAccess": false,
    "strategy": "phantom-server",
    "timeout": 40000
    "electron": {
    "allowLocalFilesAccess": false,
    "strategy": "electron-ipc",
    "timeout": 40000
    "tasks": {
    "strategy": "http-server",
    "timeout": 10000
    "scripts": {
    "allowedModules": ["mailgun-js"],
    "timeout": 40000
    "sample-template": {
    "createSamples": false
    "license-key" : "***",
    "daemon" : true

    Anything with *** is just redacted info. Another note, this was working for us like last week, but we haven't changed anything

  • It seems some of the * didn't make it. All of the above fields do have info in it, but we've redacted confidential info for our safety

  • administrators

    hmm i don't see anything wrong in your configuration, one thing to try can be to change phanthom strategy to dedicated-process and see if it changes something.

    our playground website is also running ubuntu so everything seems to point to some network block.

    Another note, this was working for us like last week, but we haven't changed anything

    hard to tell why https urls stopped working, since you haven't changed anything on the server (installed new programs or something like that) all of this looks like some block in the network layer or probably your phantomjs executable is corrupted (maybe OpenSSL in your server is not behaving correctly).

    the best would be to try on a different server with the same OS and check if it render the PDF there, if it works in another similar server then something was changed in your server but probably you did not notice.

  • dedicated-process didn't fix it

    we can wget the image/https resource from the box so we don't believe it's a network block

    We can try a new server but it will take awhile, will report back with any new developments


  • administrators

    @nuvsol thanks! let us know how the test goes, or anything relevant that you find.

  • @bjrmatos playground doesn't run on ubuntu :)

    I've Ubuntu 16.04. Running template with this particular image works there. I did also run apt-get update + apt-get upgrade, reboot and image still displays.
    There is likely something wrong between phantomjs and installed ssl libs. Unfortunately I'm not an expert on this.

    Maybe you could quickly run jsreport using docker on the particular server and test the same image. I think this would give us the answer if the issue is with the installed libs or the networking.

  • So we tried with our old server (we have two report servers) and it seemed to work. The only problem is that this other server isn't https.

  • Ok had some time to look into this and got a fix.
    Installing and switching PhantomJS from v1.9.8 to v2.1.1 seems to work.

Log in to reply

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