We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50227
    • 18 Posts
    Revo 2.5.1-pl

    I have a resource that loads jqplot - http://www.jqplot.com/ and generates a chart from data stored in my custom tables. Jqplot has a feature that will generate an image (png) on the fly and display it in a div. All working fine.

    I would now like to be able to display that image in a resource in a new window which will be converted to a pdf using pdfresource (installed and working fine).

    I've tried:
       output = '<h1>Hello, World!</h1>';
       window.open('printchart.html').document.body.innerHTML += output;//printchart.html is pdfresource
    


    the new window opens with Hello world but is overwritten by the pdf conversion - obviously cus modx doesn't know I'm passing data to printchart.html.

    I suspect I will have to save the image then load it into printchart.html but I really want to do it on the fly (with jquery???).

    I stumbled across symlinks but I haven't got my head round that and wouldn't have a clue how to go about it.

    Does any one have any advice, suggestions or pointers on how I can do this please?

    Thanks in anticipation smiley

      • 3749
      • 24,544 Posts
      If the image is saved, you should be able to just forward to printchart.html and put a snippet in the content section of that page that will create the output you want.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 50227
        • 18 Posts
        Hi BobRay - thanks for the reply smiley

        I didn't want to go down the route of saving a physical copy of the image on the server.

        I figured out how to pass the encoded string by creating a form in jqplot function that generates the image. I can now post it as a hidden form element and pick it up on a new resource in modx. I have a snippet the grabs the posted element, sets the headers for png and displays the image in an img tag. Works a treat smiley
        However - when I set the resource to convert to pdf on the fly using PDFResourse it breaks and doesn't display as a pdf. It shows a page with a blank image.

        I now need to look into PDFResource................... onwards and upwards.