Page 1 of 1

Export report as email attachment

Posted: Wed Jan 18, 2012 7:31 am
by jpascual
Hello, I have a report exported to PDF with the "PrintToPdf" and I get a popup to save or open.

I want to save the pdf at a particular site on my pc and be able to attach it as an attachment to an email. VB Function "mailto:" to open the mail manager by default with the attachment

Is it possible? Thank you.

Export report as email attachment

Posted: Wed Jan 18, 2012 8:13 am
by HighAley
Hello.
jpascual wrote:Hello, I have a report exported to PDF with the "PrintToPdf" and I get a popup to save or open.

I want to save the pdf at a particular site on my pc and be able to attach it as an attachment to an email. VB Function "mailto:" to open the mail manager by default with the attachment

Is it possible? Thank you.
There is no build-in function, but you can do it with code.

Thank you.

Export report as email attachment

Posted: Fri Jan 20, 2012 3:23 am
by jpascual
How could it by code?
I would like to generate the PDF report and save it on a computer on my machine automatically, in C:\ for example.
That would be enough to then get it to attach to an email.

Export report as email attachment

Posted: Mon Jan 23, 2012 3:05 am
by HighAley
Hello.
jpascual wrote:How could it by code?
I would like to generate the PDF report and save it on a computer on my machine automatically, in C:\ for example.
That would be enough to then get it to attach to an email.
You should use StiReportResponse.ResponseAsPdf () method.

Thank you.

Export report as email attachment

Posted: Mon Jan 23, 2012 4:29 am
by HighAley
Hello.

You could send e-mail from server. Please look at the next topics:
http://forum.stimulsoft.com/Default.aspx?g=posts&t=878
http://forum.stimulsoft.com/Default.aspx?g=posts&t=541

Thank you.

Export report as email attachment

Posted: Mon Jan 23, 2012 6:36 am
by jpascual
Thanks for your reply on how to send the email attachment.
But I want to save the file to a local folder as well. I've tried the "ExportDocument" or "" and I can not specify the path to save the file.

How I can save the pdf file of the report on a Path automatically, without confirmation email?

Export report as email attachment

Posted: Mon Jan 23, 2012 8:04 am
by HighAley
Hello.
jpascual wrote:Thanks for your reply on how to send the email attachment.
But I want to save the file to a local folder as well. I've tried the "ExportDocument" or "" and I can not specify the path to save the file.

How I can save the pdf file of the report on a Path automatically, without confirmation email?
There is a browser restriction for saving files on computer.

Please, describe your problem more detailed.
Do you want to save pdf-file from browser on your local machine in the certain folder?
Or do you want to save pdf-file on server and send it by mail automatically?

Thank you.

Export report as email attachment

Posted: Mon Jan 23, 2012 8:11 am
by jpascual
I want save pdf-file on a Path in the server.

Then I send it by attachment file to Outlook email using "mailto:" function.

Getting the attachment from the path where I saved before.

Export report as email attachment

Posted: Mon Jan 23, 2012 9:01 am
by HighAley
Hello.
jpascual wrote:I want save pdf-file on a Path in the server.

Then I send it by attachment file to Outlook email using "mailto:" function.

Getting the attachment from the path where I saved before.
Then you can use next code to export report to stream and then save it where you want:

Code: Select all

StiPdfExportSettings settings = new StiPdfExportSettings();
settings.PageRange = pageRange;
settings.ImageQuality = imageQuality;
settings.ImageResolution = imageResolution;
settings.EmbeddedFonts = embeddedFonts;
settings.StandardPdfFonts = standardPdfFonts;
settings.ExportRtfTextAsImage = exportRtfTextAsImage;
settings.PasswordInputUser = passwordUser;
settings.PasswordInputOwner = passwordOwner;
settings.UserAccessPrivileges = userAccessPrivileges;
settings.KeyLength = keyLength;
settings.UseUnicode = useUnicode;

MemoryStream stream = new MemoryStream();

StiPdfExportService export = new StiPdfExportService();
export.ExportPdf(report, stream, settings);
Thank you.