Prevent User Interaction on Export

4 posts, 0 answers
  1. John S.
    John S. avatar
    90 posts
    Member since:
    Aug 2004

    Posted 31 Jul 2009 Link to this post

    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
  2. Janus Pedersen
    Janus Pedersen avatar
    34 posts
    Member since:
    Dec 2008

    Posted 31 Jul 2009 Link to this post

    Hi John Stewart
    Yes I can be done.

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

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

     

    Regards,

    Janus S. Andersen

    Denmark

  3. DevCraft banner
  4. John S.
    John S. avatar
    90 posts
    Member since:
    Aug 2004

    Posted 31 Jul 2009 Link to this post

    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
  5. Janus Pedersen
    Janus Pedersen avatar
    34 posts
    Member since:
    Dec 2008

    Posted 03 Aug 2009 Link to this post

    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


Back to Top