We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37523
    • 141 Posts
    I am attempting to use the FileDownload R with my a snippet.

    I am calling the snippet via the FileDownload as follows:

    [[!FileDownload?
    	&getDir=`../PDF/[[parentAlias?]]/[[*alias]]/`
    	&extShown=`pdf`
    	&tplFile=`pdfFileRowTPL`
    	&tplWrapper=``
    	&plugins=`[
    		{	"name":"waterMarkPDF"
    			,"event":"BeforeFileDownload"
    		}]`
    ]]


    The waterMarkPDF snippet which I call does not seem to be working. waterMarkPDF is a call to SetAsigns setapdf-stamper php.

    My hope is that when the user clicks on a pdf link, FileDownload parses to waterMarkPDF the pdf file path, then places a watermark on the pdf (using the users loggedin username). The download then begins with a custom watermaked pdf.

    Within my waterMarkPDF snippet can I get the file link via:
    $linktofile = $plugin.getProperties('filePath');


    and the current user name via:
    $currentUser = $modx->getLoginUserName();


    Am I asking too much of FileDownload? Is there a better method that I could use for this?

    Is it possible to treat the download file as an object that then can be parsed through waterMarkPDF and then downloaded?


    • MODX Version: Revolution 2.2.8
    • PHP Version: 5.3.26
    • Database (MySQL, SQL Server, etc) Version: 5.1.70
    • Additional Server Info: Apache
    • Installed MODX Add-ons: FileDownload R 1.1.6

    This question has been answered by glynszasz. See the first response.

    [ed. note: glynszasz last edited this post 13 years, 2 months ago.]
      Glyn Szasz
      Sydney, Australia

      Happy to help (when can) and happy to learn

      If you are a Sydney based MODX developer would love to hear from you. Please contact me.
      • 11055 ☆ A M B ☆
      • 3,112 Posts
      Any error?
        Rico
        Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
        MODx is great, but knowing how to use it well makes it perfect!

        www.virtudraft.com

        Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

        Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

        Maintainter/contributor of Babel

        Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
        • 37523
        • 141 Posts
        Quote from: goldsky at Jul 14, 2013, 10:43 AM
        Any error?
        No error that I can find. Nothing seems to come up within the MODX Error Report menu item or the error_log file. Perhaps there is a debug option within DownloadR that I can enable to see what is going on.

        A thought I had that I will try a bit later today is to attempt to execute watermarkpdf within each row &tplFile and ignore the &plugins part.
          Glyn Szasz
          Sydney, Australia

          Happy to help (when can) and happy to learn

          If you are a Sydney based MODX developer would love to hear from you. Please contact me.
        • discuss.answer
          • 37523
          • 141 Posts
          The thought I had worked by the following. Within my &tplFile chunk I put:
          <li><a href="water.php?path=[[+fd.url]]" target="_blank">[[+fd.filename]]</a></li>

          where water.php is my script. This gets me around the problem of using the &plugins.
            Glyn Szasz
            Sydney, Australia

            Happy to help (when can) and happy to learn

            If you are a Sydney based MODX developer would love to hear from you. Please contact me.