This topic is locked

Email the current page as PDF Issue

12/7/2023 10:46:59 AM
ASPRunner.NET General questions
S
SaulHulse author

Hello.
I am facing one issue faalowing the the current tutorial of ASPrunner.net

https://xlinesoft.com/asprunnernet/docs/how_to_email_the_current_page_as_pdf.htm

and it looks like is not working properlly.

I have notice that in the original code that goes in Client after, the values of the Email, path and attachemnt are not beging passed (Bellow the original code)

dynamic attachment = null, a_button = null, mail = XVar.Array(), path = null, a_result = XVar.Array(), ret = XVar.Array(), var_params = XVar.Array();
path = XVar.Clone(button.saveTempFile((XVar)(var_params["pdf"])));
mail = XVar.Clone(XVar.Array());
mail.InitAndSetArrayItem(var_params["email"], "to");
mail.InitAndSetArrayItem("Runner PDF and Email demo", "subject");
mail.InitAndSetArrayItem("Check the results", "body");
attachment = XVar.Clone(new XVar("path", path, "name", var_params["filename"]));
mail.InitAndSetArrayItem(new XVar(0, attachment), "attachments");
ret = XVar.Clone(MVCFunctions.runner_mail((XVar)(mail)));
if(XVar.Pack(ret["mailed"]))
{
result.InitAndSetArrayItem(true, "success");
}
else
{
result.InitAndSetArrayItem(ret["message"], "message");
result.InitAndSetArrayItem(false, "success");
}
return null;

To make it work meke sure that you change it for the following code:

dynamic attachment = null, a_button = null, mail = XVar.Array(), path = null, a_result = XVar.Array(), ret = XVar.Array(),
path = XVar.Clone(button.saveTempFile((XVar)(var_params["pdf"])));
mail = XVar.Clone(XVar.Array());
mail.InitAndSetArrayItem(parameters["email"], "to");
mail.InitAndSetArrayItem("Runner PDF and Email demo", "subject");
mail.InitAndSetArrayItem("Check the results", "body");
attachment = XVar.Clone(new XVar("path", path, "name", parameters["filename"]));
mail.InitAndSetArrayItem(new XVar(0, attachment), "attachments");
ret = XVar.Clone(MVCFunctions.runner_mail((XVar)(mail)));
if(XVar.Pack(ret["mailed"]))
{
result.InitAndSetArrayItem(true, "success");
}
else
{
result.InitAndSetArrayItem(ret["message"], "message");
result.InitAndSetArrayItem(false, "success");
}
return null;

My sugestion for the Xlinesoft is: please update the ASPRunner manual (This is not the only example with problems in the manual).