Announcement

Collapse
No announcement yet.

How attach to e-mail the printing image or the pdf of a form

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How attach to e-mail the printing image or the pdf of a form

    Hi all,
    I got a form (master/details) and I got the Print button that works as expected.
    On header of form I got another button that is Send E-Mail .
    What I need to do is to add to e-mail as attachment the print image or the pdf of form .
    The e-mail works nice and has also attached the detailed CSV file yet.

    I've searched on forum posts but I didn't find any question like this.
    Every hint and suggestion are really wellcome.
    Thanks
    Attached Files

  • #2
    i Would recommend to use dompdf for that... it allows to generate a pdf from html content, so you can simply give it an url or html code to generate the pdf and then attach it to the e-mail


    http://www.digitaljunkies.ca/dompdf/

    Regards

    Comment


    • #3
      Hello, thanks.
      sorry for stupid question but I'm not a programmer..;-(
      just to understand... It seems that I can't simulate with SC what the Printing button action does. Is it correct ?
      Need I to develop a report under that dompdf ? Is it like SC Pdf Report ? Is it a php library ?
      Under the send e-mail code have I to add that report ?
      Is there a simple sample to see ?
      Thanks

      Comment


      • #4
        @kafecadm,

        this seems simple and powerful yet nice, first time to hear of it

        could you give us examples on how to use this thing in sc? that would be great

        just a simple example how to implement for instance a simple report, would be really helpful

        Comment


        • #5
          When you install dompdf (look at the documentation) you can use a snipet just like this

          PHP Code:
          // generate the link to my form
          $link sc_make_link('myform'param1=0param2='Hello world');

          // read the content, in other words ask php to gather the html code of the form
          $html file_get_contents($link);

          // use dompdf to create the  pdf
          $dompdf = new DOMPDF();
          $dompdf->load_html($html);
          $dompdf->render();
          $dompdf->stream("sample.pdf");

          // add code to send it for email, download it, destroy it, zip it or w/e =D 
          And yes giovannino you have to install a package into your php environment, the first link i sent you have a documentation section wich explains how to install it(simply have to copy the files in some folders of your environment and then reference that with the use once statement of php).
          Regards
          Last edited by kafecadm; 03-04-2015, 09:00 PM.

          Comment


          • #6
            Originally posted by kafecadm View Post
            (simply have to copy the files in some folders of your environment and then reference that with the use once statement of php).
            Regards
            I think this is what what people are missing including me, simply for you, not for the rest looool when you say reference that in what? we can google it, but how to be applied in SC is probably not easy to figure if you dont know all the alphabetcs and how to do everything

            including when code is there, where to use that? events? ajax events? just code! great! how and where to apply it, I guess it is the point we miss here in SC, the initial steps of what to do first and why

            for me i don't need PDF functionality now, but i will need it soon anyway, it is important point at the end must be there

            Comment


            • #7
              Well for that i would need to make a tutorial and to be honest atm I can't but there's plenty of examples and tutorials available online, remember that events are simply php code so for example you can create a button [ P D F ] in your form and paste the code I gave you.

              Regards

              Comment


              • #8
                I agree, also SC team should provide that, we respect each one's time

                will give it a try FOR SURE, thanks sempai

                Comment

                Working...
                X