How can attache to mail a pdf report ?

I got a button on a form that run a pdf report with this command

sc_redir(report_pdf_orders_form, parm1=[glo_OrderID]); It works as expected .

I need now to insert the pdf creation and the subseguent attachement of that pdf file, during the automatic creation of a Order, to a generated mail .
I send a mail with Customer Order detail to customer e-mail but I need to attach the pdf report too.

On local it seems to be under http://127.0.0.1:8081/scriptcase/tmp/sc_pdf_20170207121315_285_report_pdf_orders_form.pdf

but when I will be on hosting server where can I intercept that pdf connected to Order created ?

How can I made the attachment then ?
Many thanks

Hello Gio,

Do you use a PDF application to generate your PDF or the export option?

I’ve used the PDF report application with the function sc_pdf_output($_SERVER[‘DOCUMENT_ROOT’] . “PDF/“nameofPDFfile”.pdf”,“F”); in the code to easily save and find my generated PDF files.

$_SERVER[‘DOCUMENT_ROOT’] maps the root directory from where you run your website, the “PDF/” part saves your generated PDF’s in the directory PDF.

Now as attachment you can use $_SERVER[‘DOCUMENT_ROOT’] . “PDF/“nameofPDFfile”.pdf”.

Hope this helped you a bit.

Hello,
I did already the creation and the saving of PDF file under a folder. It works.
The issue now is about the creation of SC of a message every time it finish the creation of PDF —> “PDF Creation terminated” Back…
It create a page but I want to overcome and jump that message.
I want only create the pdf in background and attach it ot an automatic email . That is the Sales Order made on line…

Is there a way to don’t show that page ???

See image

message.jpg

there is no such function called sc_pdf_output. Which version you were using? May be this has been removed now.

Hello Iata,
unfortunately it’s too much time I don’t use PDF and I don’t remember so much about it. Let’s have a check on SC macro.