This is a migrated thread and some comments may be shown as answers.

Prevent User Interaction on Export

3 Answers 48 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
John S.
Top achievements
Rank 1
John S. asked on 31 Jul 2009, 07:48 PM
Hello,

I am exporting a PDF in code (not using the web viewer) and would like to prevent the user from interaction with the rest of the side until the Open/Save dialog prompt. Does anyone know if this can be done. And if so, how?


Thanks,
John

3 Answers, 1 is accepted

Sort by
0
Janus Pedersen
Top achievements
Rank 2
answered on 31 Jul 2009, 11:55 PM
Hi John Stewart
Yes I can be done.

/// <summary>  
/ / / This method is used to provide a report to deliver a stream   
/ / / Eg. Page.Response.OutputStream could be the recipient of this   
/ / / Remember to set the mime type Page.Response.ContentType = "application / pdf";  
/// </summary>  
/ / / <param Name="report"> Object containing the report you want to be saved </ param>   
/ / / <param Name="output"> A stream containing the report as a PDF </ param>  
public static void SaveReportAsPDF(Telerik.Reporting.Report report, Stream output)  
{  
 string mimeType;  
 string extension;  
 Encoding encoding;  
 var reportBytes = ReportProcessor.Render("PDF", report, nullout mimeType, out extension, out encoding);  
 output.Write(reportBytes, 0, reportBytes.Length);  

Can be used in Page_Load as
var report = new DokumenterRap (); / / Creates new report type document   
Response.ContentType = "application / pdf"; / / Sets as pdf mimetype for IE to open the PDF file   
ReportTools.SaveReportAsPDF (report, Response.OutputStream); / / Creates a stream of PDF repport   
Response.Flush (); / / Provides the stream is flushed. 

 

Regards,

Janus S. Andersen

Denmark

0
John S.
Top achievements
Rank 1
answered on 01 Aug 2009, 01:08 AM
Hello Janus,

My problem is not exporting the document. My problem is .... as the user is waiting for the report (which may sometime take 2-30 seconds) I don't want them to be able to interact with the website (click the export button again is my biggest concern). Perhaps I am mistaken, but I don't think what you offered will do that.

Thanks,
John
0
Janus Pedersen
Top achievements
Rank 2
answered on 03 Aug 2009, 09:47 AM
Hi John
I see. No the code is just for the Expert.

If you call a new page and the new page have to panels. one to make the PDF and one to show a text that state "pls. Wait for the PDF to be created this will take from 30 sekund to 3 min". In your code you store a session variabel to keep the info if this user has stated the PDF. Just store the time the PDF was started. I think that will do the job.

in the ASPx file put in this for one of the panel, and false for the panel with the text. 
ShowContentDuringLoad="false" 

Hint: You can use the Modal="true"

Regards,
Janus S. Andersen
 
Denmark


Tags
General Discussions
Asked by
John S.
Top achievements
Rank 1
Answers by
Janus Pedersen
Top achievements
Rank 2
John S.
Top achievements
Rank 1
Share this question
or