We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4172
    • 5,888 Posts
    Because tcpdf needs a lot server-performance to genarate the pdf, I think its better to save your generated pdfs as files and put a link on your page for downloading this file.

    to generate the content you can for example have a button, which calls a js-function to read the parsed content and sends it with an ajax-request to an resource where you have your snippet which generates your pdf.

    Or create a plugin, which reads the parsed content-part for generating the pdf file.
      -------------------------------

      you can buy me a beer, if you like MIGX

      http://webcmsolutions.de/migx.html

      Thanks!
      • 4041
      • 788 Posts
      Well, it was like that, but when i found that "$modx->documentObject[’content’]" prints the snippet calls without "parsing"

      Maybe this will help:

      <?php // highlighting purposes only
      
      
      $resource_content =$modx->documentObject['content']; 
      $pdf_content = $modx->parseDocumentSource($resource_content);
        xforum
        http://frsbuilders.net (under construction) forum for evolution
        • 19370
        • 24 Posts
        Quote from: Breezer at Apr 15, 2010, 03:13 PM

        Well, it was like that, but when i found that "$modx->documentObject[’content’]" prints the snippet calls without "parsing"

        Maybe this will help:

        <?php // highlighting purposes only
        
        
        $resource_content =$modx->documentObject['content']; 
        $pdf_content = $modx->parseDocumentSource($resource_content);

        Hey Breezer, thanks for your answer! smiley

        read my answer here, that talks about document parsing:
        http://modxcms.com/forums/index.php/topic,45989.msg282895.html#msg282895

        Sorry, let me ask you one thing... Parsing is executing vars and snippet calls right?

        Thanks
          • 19370
          • 24 Posts
          Quote from: Bruno17 at Apr 15, 2010, 02:18 PM

          Because tcpdf needs a lot server-performance to genarate the pdf, I think its better to save your generated pdfs as files and put a link on your page for downloading this file.

          to generate the content you can for example have a button, which calls a js-function to read the parsed content and sends it with an ajax-request to an resource where you have your snippet which generates your pdf.

          Or create a plugin, which reads the parsed content-part for generating the pdf file.

          Hi again Bruno, thanks for your reply! wink

          I will explain how conversion works. One example, i have one page to make a budget page, and that page returns the form values to my pdf page. That pdf page use ditto to read the structure of the budget and print the vars to phx read it on post. Something like that:

          Ditto template:
          
          <p><b>[+pagetitle+]</b> - [+phx:post=`option-[+id+]`+]</p><br />
          


          then it goes to my custom database to get client data.

          then, when everything gots parsed, it will be converted to pdf, and sended by email for comercial admin and my client (because the budget is for resseling).

          Hope you all understand, sorry for my english. wink