• Resolved Kochhase

    (@kochhase)


    Hi Dinamiko,
    is there a way to send the generated pdf via mail as attachment? See the code from the mpdf 6.0 that you are using? The best would be to interact with formidable pro and the generated views.

    // mPDF 5.7.4
    if (substr($path,0,7) == “mailto:”) { return; }
    if (substr($path,0,3) == “../”) { //It is a Relative Link
    $backtrackamount = substr_count($path,”../”);
    $maxbacktrack = substr_count($basepath,”/”) – 3;
    $filepath = str_replace(“../”,”,$path);
    $path = $basepath;
    //If it is an invalid relative link, then make it go to directory root
    if ($backtrackamount > $maxbacktrack) $backtrackamount = $maxbacktrack;
    //Backtrack some directories
    for( $i = 0 ; $i < $backtrackamount + 1 ; $i++ ) $path = substr( $path, 0 , strrpos($path,”/”) );
    $path = $path . “/” . $filepath; //Make it an absolute path
    }
    else if( strpos($path,”:/”) === false || strpos($path,”:/”) > 10) { //It is a Local Link
    if (substr($path,0,1) == “/”) {
    $tr = parse_url($basepath);
    // mPDF 5.7.2
    $root = ”;
    if (!empty($tr[‘scheme’])) { $root .= $tr[‘scheme’].’://’; }
    $root .= $tr[‘host’];
    $root .= ((isset($tr[‘port’]) && $tr[‘port’]) ? (‘:’.$tr[‘port’]) : ”); // mPDF 5.7.3
    $path = $root . $path;
    }
    else { $path = $basepath . $path; }
    }
    //Do nothing if it is an Absolute Link
    }

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author dinamiko

    (@dinamiko)

    Hi Kochhase,

    yep that’s something I have in my radar, but I did not thinked much about it really. once I have more time I’ll give it a try, maybe as a paid addon may make sense, let′s see…

    Thanks,
    Emili

    Hi Kochhase,

    I think this can be done using Formidable Forms:

    1. Add an e-mail field to your Formidable form and enter the address the pdf should be sent to
    2. Create a view in Formidable to display the results of your form
    3. Set up an e-mail notification form action with the id of your email field in the recipient field
    4. Insert an url like <a href="https://yoursite.com/results/entry/[id]/?pdf=xx">Download pdf</a> where [id] is the id of the form entry, i.e. the message id.

    • This reply was modified 7 years, 1 month ago by Hugo Callens.
    Thread Starter Kochhase

    (@kochhase)

    Hi Hugo Callens,
    thank you for that code. Is the link “https://yoursite.com/results/entry/%5Bid%5D/?pdf=xx&#8221; the standard for DK-Pdf? When I create a PDF, the PDF is always stored temporarily in this path?
    then your suggestion should work. Have you already implemented it so with formidable?
    thanks Henryk

    https://yoursite.com/results/entry/[id]/ (or something like that) is the path you create using formidable forms. Append ?pdf=xx to this url in order to generate the pdf.

    Have a look at the output you get when clicking the dkpdf button to see what the complete url should look like.

    • This reply was modified 7 years, 1 month ago by Hugo Callens.
    Thread Starter Kochhase

    (@kochhase)

    I have tried now with different options. But no success. The question is: where is the generated PDF, which can be sent as mail. In the backend of the DK-PDF plugin is it not? It is created somewhere temporarily but the PDF should be stored with Formidable Pro in the backend at the Entries, so you can download it later.

    The pdf is indeed created temporarily I believe. I do not know how long this link lasts; check that with the plugin author.

    The point is: you don’t send the pdf, but the link to the url where the pdf can be accessed and downloaded: the link that is generated by the create pdf button.

    So when the recipient opens the mail message and clicks the link, she/he can download the pdf.

    Plugin Author dinamiko

    (@dinamiko)

    hey there,

    just my 5 cents ?? the PDF is generated in the server then you can show it in the browser or download it.

    As @prettiggeleerd said, it is possible to generate the PDF directly from an URL, you only need to know the post id and then pass it as parameter, like so: <site>/?pdf=<post-id>

    Thread Starter Kochhase

    (@kochhase)

    Hi Emili Castells,
    yes that is working for now.
    First: how long is the link working?
    Secound: Is there a way to get the generated pdf via mail as attachment?
    thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘pdf sending via mail’ is closed to new replies.