Export report as email attachment

Stimulsoft Reports.WEB discussion
Post Reply
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

Export report as email attachment

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Export report as email attachment

Post 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.
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

Export report as email attachment

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Export report as email attachment

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Export report as email attachment

Post 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.
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

Export report as email attachment

Post 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?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Export report as email attachment

Post 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.
jpascual
Posts: 68
Joined: Mon Jul 12, 2010 6:45 am
Location: Palencia

Export report as email attachment

Post 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.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Export report as email attachment

Post 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.
Post Reply