WebViewer PDF OnlyForPrint

Posted by: stacey.manske on 16 July 2020, 1:35 am EST

    • Post Options:
    • Link

    Posted 16 July 2020, 1:35 am EST

    I’m upgrading ActiveReports from version 12 to 14 and was using the WebViewer flash startprint option to automatically bring up the print dialog.

    Updating the viewer and switching to the PDF OnlyForPrint works but when you print and then click a link to go to another page and then use the back button, the print dialog with the report pops up again. Is there any way to prevent that?

  • Posted 16 July 2020, 10:38 pm EST

    Hello,

    You can use the following line of code to prevent that:

    public string test
            {
                get
                {
                    return (string)Session["test"] ?? "hi";
                }
                set
                {
                    Session["test"] = value;
                }
            }
            protected void Page_Load(object sender, EventArgs e)
            {
              
                if(test=="test")
                this.WebViewer1.PdfExportOptions.OnlyForPrint = (bool)Session["print"];
            }
    
            protected void Button1_Click(object sender, EventArgs e)
            {
                Session["test"]= "test";
                Session["print"] = false;
                Response.Redirect("WebForm2.aspx");
            }
    

    Thanks,

    MOhit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels